开发者

should a UIActionSheet prompt issued during "viewDidLoad" method halt code in the method until it is actioned by user?

开发者 https://www.devze.com 2023-02-18 21:48 出处:网络
should a UIActionSheet prompt issued during \"viewDidLoad\" method h开发者_运维知识库alt code in the method until it is actioned by user?

should a UIActionSheet prompt issued during "viewDidLoad" method h开发者_运维知识库alt code in the method until it is actioned by user?

Background: I am trying to use UIActionSheet to prompt the user during "viewDidLoad" to ask whether they want test Data populated, however it appears that the rest of the lines of code in the "viewDidLoad" method keep completing whilst the prompt is waiting for user input?


Split your initializing code into a main initializer and the action sheet delegate method. Call your action sheet from the initializer and let the delegate method finish the initializing there.


you can't wait (= halt your code) for input of an UIActionSheet or anything else.

You have to implement a UIActionSheetDelegate and do what you want to do inside the actionSheet:didDismissWithButtonIndex: method.

0

精彩评论

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