Xcode - update ViewController label text from different view

后端 未结 4 2012
予麋鹿
予麋鹿 2020-12-01 21:54

I have two view Controllers in my project ViewController, SettingsView. Here I am trying to update the ViewController\'s label, when i

4条回答
  •  时光取名叫无心
    2020-12-01 22:49

    Your label is not updating because , you are trying to call updateLabel method with a new instance.

    You should call updateLabel of the original instance of viewcontroller from which you have presented your modal view.

    you can use a delegate mechansim or NSNotification to do the same.

    Delegate mechnaism would be clean. NSNotification is quick and dirty.

提交回复
热议问题