开发者

iOS: selecting option returns null first time, not second time

开发者 https://www.devze.com 2023-03-23 13:38 出处:网络
I have an iOS application where you select an option before you log in开发者_JAVA百科. The way it works is that you click on the button that says \"Select\", then it takes you to a UITableViewControll

I have an iOS application where you select an option before you log in开发者_JAVA百科. The way it works is that you click on the button that says "Select", then it takes you to a UITableViewController which shows you the options, you select the option, and it takes you back to the previous menu with the text replaced with your selection (and a hidden ID saved, too).

During the update of the information (which takes place in tableView:didSelectRowAtIndexPath:) I call NSLog on the object. The first time I call it, it returns null (BUT for some reason the text still changes!) and the second time I call it, it works! Why doesn't it work the first time????

Thanks


Do you put the NSLog line before the previous view push back code ?


The variable was named incorrectly. I don't know why XCode didn't just tell me this instead of giving me an EXC_BAD_ACCESS, but that's what happened.

0

精彩评论

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