Questions tagged [viewdidload]

Method in UIViewController class (Apple iOS SDK) for managing the view. Called after the controller’s view is loaded into memory.

This method is called after the view controller has loaded its associated views into memory. This method is called regardless of whether the views were stored in a nib file or created programmatically in the loadView method. This method is most commonly used to perform additional initialization steps on views that are loaded from nib files. Available in iOS 2.0 and later.

722 questions
7
votes
4 answers

When is viewDidLoad called?

Is it safe to assume that an attribute, namely fetchedResultsController, of chatViewController, an instance of a subclass of UITableViewController, is always nil when viewDidLoad is called, assuming that it's set to nil in viewDidUnload? Phew! If…
ma11hew28
  • 121,420
  • 116
  • 450
  • 651
7
votes
1 answer

Difference between viewDidAppear, viewDidLoad in iPhone/iOS?

Bottom line is, I've been working on an app, and it seems that if I place a UIAlert in viewDidLoad, it gets called twice (from a delegate method of UIImagePickerController). If I put it in viewDidAppear, it gets called once. I've looked through…
Sidwyn Koh
  • 1,742
  • 2
  • 21
  • 29
7
votes
3 answers

Reload and not reload if press back from different view controllers. Swift

The top three answers can solve my questions. It is hard to pick which one is the best. So, I just pick the one who is the first to answer my question. Sorry for amateur and iOSEnthusiatic. Thank you for your help. I appreciate it. ViewController…
Pak Ho Cheung
  • 1,382
  • 6
  • 22
  • 52
7
votes
3 answers

perform segue in viewDidLoad() without navigation controller in Swift

I have three views (view 1 checks a server connection, view 2 shows the main content, view3 shows the support page) and I created them in the storyboard without coding. On starting my iOS app the view 1 shows a spinner while checking the server…
GRme
  • 2,707
  • 5
  • 26
  • 49
7
votes
3 answers

How to add an animation to the UIView in viewDidAppear?

I tried to add a animation to viewDidLoad and viewDidAppear, but it doesn't work: - (void)viewDidAppear:(BOOL)animated{ [UIView beginAnimations:@"transition" context:NULL]; [UIView setAnimationTransition:110 forView:self.view cache:YES]; [UIView…
Flocked
  • 1,898
  • 2
  • 36
  • 57
6
votes
2 answers

Set UITabBarItem title programmatically?

My app is based on a tab bar architecture. In order to have an easy internationalisation mechanic, I do not write any string in XIB files. viewdidload permits to change programmaticaly the strings in the views. When my app launches, I can see the 4…
kheraud
  • 5,048
  • 7
  • 46
  • 75
6
votes
2 answers

When I switch back and forth between views, my viewDidLoad is not being called a second time?

So I have two views. One views loads when I start the app. Then when I press a button on that view it loads a another view. - (IBAction)triggerGame { leveldata = [[NSMutableDictionary alloc] init]; [leveldata setValue:@"hide"…
kernelpanic
  • 530
  • 2
  • 8
  • 26
6
votes
2 answers

How do I detect an iPad's interfaceRotation at the start?

I'm having problems getting my iPad app to detect its interfaceOrientation in the first UIViewController I initialize (in code). In fact, if I trace for application.statusBarOrientation, that too returns 1 (UIInterfaceOrientationPortrait) even if I…
jowie
  • 8,028
  • 8
  • 55
  • 94
6
votes
4 answers

Does viewDidload method call again on going back to a screen in navigation controller?

I am using navigation controller. I have pushed two viewcontroller to navigation stack. When I am coming back to viewcontroller1 from viewcontroller2 using back button of navigation bar then viewdidload method of viewcontroller1 is called again.But…
Kirti
  • 573
  • 2
  • 8
  • 18
6
votes
4 answers

ViewController Appears to Transition Twice

Problem Summary My mainVC --> second VC transtion appears to run twice. However, what's odd is that the second VC's viewDidLoad only runs once. This is the only transition in my project that has this problem. I have researched this and found…
Dave G
  • 12,042
  • 7
  • 57
  • 83
6
votes
2 answers

iOS presentViewController doesn't invoke viewDidLoad

I'm implementing my own 'back' button. Where onClick, the following code is executed in the ViewController (VC) being dismissed: Dismiss current VC (VC#1) Pop current VC (VC#1) off my custom navigationStack Get the last VC (VC#2) from the…
snowbound
  • 1,692
  • 2
  • 21
  • 29
6
votes
5 answers

About viewController's "viewDidLoad" and "viewWillAppear" methods

I've got a question regarding the two mentioned methods, since in my tests I don´t make clear the order they are called. I thought that, firstly, viewDidLoad is called when the viewController is loaded for first time (as the name indicates), and…
AppsDev
  • 12,319
  • 23
  • 93
  • 186
6
votes
1 answer

What are the differences between didFinishLaunchingWithOption and viewDidLoad

What is the difference between the two methods didFinishLaunchingWithOption and viewDidLoad? The former is a method of AppDlegate.m and the latter is a method of ViewController.m, but both of them perform the same mission of loading the UIs onto the…
JackieLam
  • 668
  • 1
  • 7
  • 20
5
votes
2 answers

How to call viewDidLoad method when back button is pressed in UINavigationController? (iPhone / iPad)

I need a way of calling the viewDidLoad method when the 'back' button is pressed in the UINavigationController. So for example if I have a flow like so: View A -> View B -> View C I need the it so that if I'm on View C and I press back, View B's…
user843337
5
votes
4 answers

How to find out the exact frame of a UIViewController's view?

When is it possible to know the exact size of a UIViewController's view? The Problem I have a multi-line UILabel whose frame depends of its text and the width of the parent view. Given that I need to position other views below the UILabel, it's…
hpique
  • 119,096
  • 131
  • 338
  • 476
1 2
3
48 49