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

How to call method when app enters foreground from background

Is there a simple way to call a method when my app enters the foreground from the background? I have my program call a method "nowYouSeeMe" in the viewDidLoad method, which works great when running the app the first time. When I use the app and then…
user3542888
  • 59
  • 1
  • 4
3
votes
1 answer

Why does adding subview in viewDidLoad doesn't work

I was trying to add UIToolBar into a UIWebView but whenever I insert this code inside viewDidLoad UIToolBar doesn't show up, however when this is done in viewWillAppear, it works. Can someone please explain it to me. -(void)viewDidLoad { [super…
user3526002
  • 537
  • 2
  • 8
  • 19
3
votes
2 answers

Perform call to server in viewDidLoad

I'm pretty new on iOS development and I'm having the following problem. I need to fill a UITableView with data fetched from a server. I'm doing this call using AFNetworking. I want to show a "loading view" using SVProgressHUD and I'm doing the…
3
votes
2 answers

iOS7 / XCode5 - "viewDidLoad" called at once, rather than when "presentViewController" was called

I have just upgraded to XCode5 and iOS7 and now my application has stopped working. I am creating a new view based on a property of a current view, and I need to set some properties of the new view before I display it. Previously, I did it like this…
Angelholme
  • 35
  • 1
  • 6
3
votes
1 answer

viewDidLoad vs. loadView for custom container controllers

I'm writing a custom container controller that programmatically instantiates a child view controller and several views. Also, the child view controller programmatically instantiates a view that I then manually add to the container's view hierarchy…
earksiinni
  • 407
  • 3
  • 13
3
votes
3 answers

How do a ViewController knows it got focus on iOS? Like a "viewDidLoad"

I have a NavigationController and one of the tabs is supposed to load a ViewController. This ViewController (1), when loaded on "viewDidLoad" does some stuff and then pushes a new ViewController (2). The thing is that after ViewController (1) has…
RickON
  • 395
  • 7
  • 18
3
votes
2 answers

ViewDidLoad Method is called again

I have two View Controller. In the first I do some stuff and then I can push the second View Controller by clicking a button (the button connected with the other ViewController in the storyboard). There I can do some settings and so on. I get back…
user1554681
  • 105
  • 8
3
votes
1 answer

Setting a property in PrepareForSegue is null for ViewDidLoad but correct later on

I have searched up and down on this and found a few that were similar but not my exact problem. In my detail view controller I have a segue that opens a popover table view controller. In the PrepareForSegue method, I set a property of the table…
mjew19
  • 33
  • 3
3
votes
1 answer

Error: Mutating method sent to immutable object for NSMutableArray from JSON file

This seems to be a fairly common problem, but the solutions that I have looked at do not solve the error. I am trying to read an NSMutableArray from a JSON file. Many of the suggestions I have seen involve using mutableCopy or [NSMutableArray…
Valentine
  • 103
  • 1
  • 4
3
votes
0 answers

Segueing from viewcontroller in ViewDidLoad

I'm running into a problem in an app that I'm developing. The user needs to log into a server to get his account information on the iPhone but once he is logged in he won't need to log in again the next launch. Since the login page is the initial…
califrench
  • 429
  • 6
  • 13
2
votes
0 answers

Using viewDidLoad after didReceiveMemoryWarning and viewDidUnload

I am still trying to understand the process of managing views when meory warnings occur. I received some good information in this answer, but I still have questions. Suppose I have a view controller VC1 that contains a subview that is managed by…
2
votes
1 answer

What data is better to initialize in loadView versus init

When memory is low and views get cleaned up by the OS, my understanding is that viewDidUnload is an appropriate place to clean up objects and memory used by your UIViewController (that otherwise wouldn't get cleaned up as a function of being in the…
Joey
  • 7,537
  • 12
  • 52
  • 104
2
votes
1 answer

Left-aligned text at viewDidLoad instead of center with custom font

I'm using a custom font on an iPhone app. This font is used on UIButtons and is displaying well. In IB, I'm setting up horizontal alignement to center and changing the font programaticly with : [self.playButton.titleLabel setFont:[UIFont…
choomz
  • 135
  • 11
2
votes
1 answer

two viewDidLoad messages when only one expected

Can anybody think of why this line of code [self.view insertSubview:dataInputController.view atIndex:0]; would generate two viewDidLoad messages to the dataInputViewController followed by one viewWillDisappear and one dealloc? I expected a…
user990380
  • 21
  • 2
2
votes
2 answers

UITableView and ViewDidLoad method

In my app I have a UITableViewCobtroller which creates the table view with checkmark accessory type. Table View loads and works correctly. In didSelectRowAtIndex method I wrote method of adding data in sqlite dataBase: …
Alick Dikan
  • 65
  • 2
  • 3
  • 10