How can I reset my UI when the user presses a button?
I have 开发者_运维百科1 scrollview that contain 18 buttons.
1) when a user taps on any button, a button is added to a second UIScrollView.
2) Then, when a user taps on that button on second scrollview the button is removed from second scrollview.
both uiscrollviews contain a list of their buttons.
Afree both of these steps, I have to reload my scrollview.
Can I do the same task by adding observer, so that it will automatically reload when any action done on button, and if yes then how?
You should look into the NSNotificationCenter class and notifications for this. You can post a notification and have the appropriate class respond to that notification. Here is a reference from Apple:
Basically, your parent view will add itself as an observer of a notification. You generally define the constant that represents your notification. Then, add code to your buttons or scroll views to post the Notification at the appropriate time(s).
精彩评论