viewdidload

Same view controller loads twice

喜夏-厌秋 提交于 2019-12-20 05:01:19
问题 I've read several posts on this issue but none of them solved my problem. I'm coding an app where I have to click on a button ("Prepare") to go to the following ViewController. When the button is clicked, it also passes data between the two view controller. The problem is, when I click the button, the following ViewController loads twice. Thus, if I want to go back I have to go back through two same ViewController. I've checked the segue, the class names and files names but nothing fixes it.

viewDidLoad being called before didSelectRowAtIndexPath

有些话、适合烂在心里 提交于 2019-12-19 09:53:06
问题 I have viewDidLoad (of next tableView) being called before didSelectRowAtIndexPath (of current tableView ). I am using a 'singleton' to hold my model and up to now this has been working quite well. I am trying to pass on the row selected in the current table in didSelectRowAtIndexPath to the destination tableview (they are linked by a segue in storyboard) by setting by the variable in didSelectRowAtIndexPath . However the viewDidLoad of the destination tableview is called before I can set the

viewDidLoad being called before didSelectRowAtIndexPath

喜夏-厌秋 提交于 2019-12-19 09:52:28
问题 I have viewDidLoad (of next tableView) being called before didSelectRowAtIndexPath (of current tableView ). I am using a 'singleton' to hold my model and up to now this has been working quite well. I am trying to pass on the row selected in the current table in didSelectRowAtIndexPath to the destination tableview (they are linked by a segue in storyboard) by setting by the variable in didSelectRowAtIndexPath . However the viewDidLoad of the destination tableview is called before I can set the

Perform Segue in ViewDidLoad [duplicate]

好久不见. 提交于 2019-12-19 05:24:14
问题 This question already has answers here : Perform Segue on ViewDidLoad (12 answers) Closed last year . I`m trying to perform a segue if its the first time the app is loading. I can see my print message in the debugger, but the Perform Segue is not working. I don't get any errors. Can somebody please tell me whats wrong? import UIKit import LocalAuthentication let isFirstLaunch = UserDefaults.isFirstLaunch() extension UserDefaults { // check for is first launch - only true on first invocation

Is there an iOS method that fires when Autolayout has completed?

心不动则不痛 提交于 2019-12-18 19:31:52
问题 I have an iOS app in which I need to know when a new view is completely visible on-screen; that is, when Autolayout has finished its calculations and the view has finished drawing. ViewDidAppear seems to fire well before the view is completely visible. If I turn off Autolayout, the timing seems to line up as far as human perception goes, but I need to use Autolayout in this project (so this isn't a solution...just a test). Is there any method that fires when Autolayout is done calculating? Or

Do I programmatically add SubViews in ViewDidAppear, ViewDidLoad, ViewWillAppear, the constructor?

人盡茶涼 提交于 2019-12-18 10:04:45
问题 I'm trying to figure out from Apple's sketchy documentation which method is the best place to be initializing and adding my Views controls to the controller's view. With winforms it's fairly straightforward, as they're always initialized inside InitializeDesigner , called in the constructor. I'm trying to match the reliability of this pattern if possible. I'm working with UIViewControllers and UITableViewControllers inside a UINavigationController most of the time - if this effects it all.

Do I programmatically add SubViews in ViewDidAppear, ViewDidLoad, ViewWillAppear, the constructor?

馋奶兔 提交于 2019-12-18 10:04:03
问题 I'm trying to figure out from Apple's sketchy documentation which method is the best place to be initializing and adding my Views controls to the controller's view. With winforms it's fairly straightforward, as they're always initialized inside InitializeDesigner , called in the constructor. I'm trying to match the reliability of this pattern if possible. I'm working with UIViewControllers and UITableViewControllers inside a UINavigationController most of the time - if this effects it all.

viewDidLoad is called twice

↘锁芯ラ 提交于 2019-12-17 20:55:01
问题 My viewDidLoad in a view controller is called twice. Once by [UIViewController View] and a second time by [UINib instanciateWithOwner:Options] . Why is this happening? Can it be prevented? 回答1: Any code you put inside of viewDidLoad should be able to run multiple times with out any issues. If you have code that only needs to run once for your controller use -awakeFromNib. The reason is because the view of the view controller can be unloaded and loaded multiple times. The code inside of

Do I always have to call [super viewDidLoad] in the -viewDidLoad method?

北慕城南 提交于 2019-12-17 04:56:32
问题 In Apple's scrollView example they don't call that. I always thought that's a must . Why should I call that anyways? 回答1: If you are overriding the method you should still call the method in the super. Even if the super class is not doing anything with it today, Apple might one day change the implementation and your code will mysteriously stop working. If you really don't need to do anything in that method, leave it out of your code entirely, and the super's method will run as usual, without

iOS: NSString when uploaded to parse.com shows blank

泄露秘密 提交于 2019-12-14 04:23:11
问题 I have taken an NSString from one class to another to be saved on parse.com I have a quiz view controller where a user enters a question in a UITextView and then they press next to go to the select friends view controller where they select a user and then send the question over parse. quiz.h @property (nonatomic,strong) IBOutlet UITextView *textField; @property (nonatomic, strong) NSString *text; quiz.m - (void)viewDidLoad { [super viewDidLoad]; UITextView *textView = [[UITextView alloc] init