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
5
votes
2 answers

What is the difference between dealloc and viewdidunload?

When should I release all the memory I allocated in my program? Because I only have a viewDidLoad method where I do my business. Should I leave dealloc empty and cleanup only in viewDidUnload?
user605957
  • 2,489
  • 6
  • 25
  • 33
5
votes
3 answers

viewDidLoad not called when using loadView

Can anyone explain why viewDidLoad does not get called when loadView is used? It's my understanding that viewDidLoad should still get called. - (void)loadView { CGRect currentFrame = [[UIScreen mainScreen] applicationFrame]; UIView* myView…
sol
  • 6,402
  • 13
  • 47
  • 57
5
votes
3 answers

Force Auto layout to update UIView frame correctly at viewDidLoad

As simple as it might be, I still find my self struggling with the correct solution. I'm trying to understand what is the correct way to find the REAL UIView(or any other subview) frame inside viewDidLoad when using Auto Layout. The main issue is…
Roi Mulia
  • 5,626
  • 11
  • 54
  • 105
5
votes
2 answers

TableViewController's viewDidLoad not firing

I've been following this tutorial to have a Slide-Out Menu. I've added a TableViewController which will display a list of articles. For some reason the viewDidLoad is not firing. In this tutorial a SideViewController controls which controller will…
j.grima
  • 1,831
  • 3
  • 23
  • 45
5
votes
2 answers

Does viewDidLoad get called more than once in UITabBarController?

I'm using SWRevealViewController in my app (to get the slide out side panel) however whenever the user navigates to another viewController like 'settings' and comes back, everything gets reset. I understand this is normal behaviour for storyboards…
Ash R
  • 195
  • 4
  • 12
5
votes
7 answers

ViewDidLoad not called when adding to Container View

I have a container view set up in my storyboard file but I want to embed the view controller programatically after setting some properties. This is my code in the parent VC's viewDidLoad: _workoutVC = [[UIStoryboard storyboardWithName:@"Main"…
circuitlego
  • 3,469
  • 5
  • 22
  • 22
5
votes
2 answers

When to put into viewWillAppear and when to put into viewDidLoad?

I get used to put either of viewWillAppear and viewDidLoad, it's OK until know. However I'm thinking there should be some rules that guide when to put into viewWillAppear and when to put into viewDidLoad?
LiangWang
  • 8,038
  • 8
  • 41
  • 54
5
votes
1 answer

Different subview layouts in viewDidLoad and viewWillAppear

Possible Duplicate: UIViewController returns invalid frame? While debugging i've noticed that in viewDidLoad call my view frame is origin=(x=0, y=20) size=(width=320, height=460) which is not accurate. In viewWillAppear call it is set up…
peetonn
  • 2,942
  • 4
  • 32
  • 49
5
votes
1 answer

CATransaction setting animation duration not working

I am learning Core Animation and trying out sample examples. When I use the following code, the animation duration works @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; //Modifying base…
Khaled Barazi
  • 8,681
  • 6
  • 42
  • 62
5
votes
5 answers

UITableView: load all cells

Is it possible to load all cells of an UITableView when the view is loaded so that they are not loaded when I'm scrolling? (I would show a loading screen while doing this) Please, it's the only way at my project (sorry too complicate to explain why…
Michael
  • 105
  • 1
  • 3
  • 9
5
votes
4 answers

iOS function to be called once (when application is initialized)

I have an iOS application. Application has 2 different views: Main and Settings. In fact, application needs to load and initialize some library and framework before it is used in Main View. When I put this initialization in viewDidLoad method, it…
mert
  • 1,942
  • 2
  • 23
  • 43
4
votes
3 answers

LandscapeOrientation on start of didload method in objective c

I've made an iPad application, It works fine when I load my application in portrait mode for first time, but when I load my application in landscape mode for the first time, it takes the coordinates of portrait mode only, because inside my didLoad…
dhaval
  • 129
  • 1
  • 8
4
votes
2 answers

A simple viewDidLoad question

I have an app with a UINavigationController with a tabBarController and quite a few views. My two main views, that correspond to the two tabs, both show a nice MBProgressHUD when they are loading data. This is triggered from viewDidLoad and only…
clifgriffin
  • 2,008
  • 3
  • 21
  • 41
4
votes
4 answers

swift setting properties in viewDidLoad doesn't work but works in viewDidAppear

Latest XCode. I have a project in which in any storyboards/view controller setting properties such as textColor of a UILabel or backgroundColor of a UIButton in viewDidLoad doesn't work but works in viewDidAppear. What kills me is that I can't…
4
votes
3 answers

Same view controller loads twice

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…
BedWolf
  • 43
  • 1
  • 4