开发者

Refresh the contents of RootViewController when Back button is Pressed in Navigationbar

开发者 https://www.devze.com 2023-02-19 08:33 出处:网络
I have a problem in uinavigationcontroller. In my application i have two view controllers VC1 and VC2. VC1 is the rootviewcontroller. In VC1 i have one textfield and one button to choose the value fro

I have a problem in uinavigationcontroller. In my application i have two view controllers VC1 and VC2. VC1 is the rootviewcontroller. In VC1 i have one textfield and one button to choose the value from the VC2. If the user clicks the button in VC1 it will navigate the user to VC2 and allow him to select any value from the tableview.

If the user selects any row in the list, i simply pops one view controller and the user is redirected to rootviewcontroller(VC1). Now i will set that selected option in the textfield in VC1.

But i don't know how to update the value if the user clicks the back button or开发者_StackOverflow selects any option in the list?


In VC1 you keep an object, while coming back from VC2 set the selected object's value to the your object in VC1. And in viewWillAppear: use the selected value from your object in VC1.

0

精彩评论

暂无评论...
验证码 换一张
取 消