I have a container view which covers the entire initial view controller with a label in the top right corner of the same view i.e. on top of the container view. I need to change the text of a label at times from views inside the container view. The label basically contains the score of the quiz and needs to be updated as the user gets a correct answer. The label is on top of the container view so that it is seen on all views inside the container view at exact same position. Please help as I am new to swift.
Asked
Active
Viewed 535 times
1 Answers
1
You can use NSNotificationCenter
to update the scores in container view.
You can do this in following way:
make your views fire a notification everytime the score changes.
Make you container view(containing the label) listen to those notifications and then change the label text accordingly.
You can refer to this link on how to use NSNotificationCenter : https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSNotificationCenter_Class/

manish_kumar
- 260
- 2
- 12
-
Thank you so much! Works perfectly – user3789185 Sep 03 '15 at 14:31