viewdidload

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

In Apple's scrollView example they don't call that. I always thought that's a must. Why should I call that anyways? ...

viewDidLoad getting called twice on rootViewController at launch

Anyone know why this root View Controller's viewDidLoad is being called twice at launch? It's driving me nuts! here's the stack trace from first time through viewDidLoad: #0 0x0000276a in -[RootViewController viewDidLoad] at RootViewController.m:71 #1 0x3097548f in -[UIViewController view] #2 0x00002734 in -[RootViewController init...

UIWindow and UIView addSubview Question

Does the addSubview method actually load the view into the application or not? The reason I am asking is because I have two two views in my application. The application delegate adds the two views as subviews and then brings one of the views up front. Now, I have a print statement in each of the viewDidLoad methods for each view. When I ...

UIImagePickerController not loading in viewDidLoad for iPhone SDK

Hi all, I'm trying to show a UIImagePickerController as soon as one of my view controller loads. I'd like to this without the user having to press a button so I overrode the viewDidLoad method as follows: - (void)viewDidLoad { [super viewDidLoad]; UIImagePickerController *imagePickerController = [[UIImagePickerController alloc...

Is it possible to have a sound play before/during the splash screen?

My app takes a few seconds to load and I have a splash screen. Once "viewDidLoad" I have a little sound play. I feel that the sound would be in better use if it started playing when the splash screen popped up. Is it possible to have a sound start before/during the splash screen? Here is my code: (under viewDidLoad) NSString *sound...

iPhone UIViews sleeping/dying after being brought back into view

Hi, I need some help. This seems to be a common problem I am having when am adding and changing views in my coding. And I would love to learn what I am doing wrong. Currently I am adding and removing views using the following calls from my view controller: [startView removeFromSuperview]; [self addSubview:secondView]; and then doing ...

How to load UIImagePickerController at viewLoad

This seems like a really simple idea... I have a button that says "load a picture". When that button is clicked I want to remove the current view, load a new one, open the image picker, get the selected picture, and display it in the view that I just loaded. I have read several documents that say UIImagePicker does not work in viewDidL...

What happens when: viewDidLoad before drawRect?

I am working on an IPhone project where I set up some drawing parameters external to view.drawRect in a procedure called -(void) reset. I call this from the viewController.viewDidLoad method to get the parameters set before the drawing occurs. But it doesn't seem that my parameters get acknowledged in the initial display of the view. ...

iPhone SDK: viewDidLoad() sees an empty NSArray, but it's populated in a delegate method (MGTwitterEngine)

This is probably obvious, but I'm a bit of a newbie and have spent hours trying to figure this out. In viewDidLoad() I have a call to a function on an MGTwitterEngine object (custom object), with an input. If the request (to Twitter, in this case) is successful, it calls an appropriate delegate method. In viewDidLoad(), it's like thi...

presentModalViewController viewDidLoad not being called

I have an event which calls a view to appear, but the -viewdidload event isn't appearing as expected each time it's called. Here's the method I use to call it... [self presentModalViewController:addItemViewController animated:YES]; then inside the addItemViewController, the method is - (void)viewDidLoad { NSLog(@"alright, lad!");...

presentModalViewController in viewDidLoad on first launch

I've been searching around but unfortunately have had no luck. My app requires the user to sign in/sign up the first time he or she launches the app. I know how to determine first launch (using NSUserDefaults) but whenever I try to present the modal containing the sign in/ sign up controls, nothing happens. Here's what I have: -(void)...

Iphone load XIB/m/h Problem

Hello, why does this not work: - (void)viewDidLoad { Login *neu =[[Login alloc] initWithNibName:nil bundle:nil]; [self presentModalViewController:neu animated:NO]; } but this works -(IBAction)dologin:(id)sender{ Login *neu =[[Login alloc] initWithNibName:nil bundle:nil]; [self presentModalViewController:neu animated:NO]; } ...

How to keep an NSArray available to all methods when programming for the iPhone.

Hello. I am making an iPhone app that uses a few NSArrays. Right now I have to generate the arrays in each method. I know there has to be an more efficient way of doing this, like having the NSArrays created during initialization and then being available to all methods after that. The problem is, that when I create the NSArrays in th...

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 commitAnimations]; } Why? ...

Iphone app development - How do I reload(?) views?

Okay, I'm working on a iPhone game. You start off on a menu screen, then select "New Game" or "High Scores". Let's select "New Game." The first time you do this, you get an alert telling you how to play the game. I implemented this with the - (id)initWithNibName function. Here is the exact code: - (id)initWithNibName:(NSString *)ni...

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

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 pa...

How to recreate UIViewController stack?

I'm writing a 'load' feature for my current iPhone app. Practically what I want to do is get the user back where s/he left off. To do so I want to recreate all the UIViewControllers appeared before. My problem is the UIViewControllers won't appear if I simply call [[self navigationController] pushViewController:newController animated:Y...

Where To Call Custom Method? viewDidLoad, viewWillLoad...

I am loading some info from a server. I have created a separate method to do this. I am then calling [self myCustomMethod] to run the method. No matter where I call [self myCustomMethod] (initWithNibName, viewDidLoad, viewWillLoad, viewWillAppear, viewDidAppear), the custom method is getting called twice - what's the deal? ...

iPhone: UIAlert dialog Appears 3 Times for Every Call

Hello community, I have a UIAlert that pops up 3 times every time it is called. It appears and then disappears before I can click on it. Could it be that the viewDidLoad itself is being called 3 times? I implemented an UIAlert in the viewDidLoad of my app: UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title message:alertMess...

iPhone SDK - (void)viewDidLoad { } - Show Progress

I have a long - (void)viewDidLoad { } function that uses the internet to load a page, and whenever the application loads the URL, the screen is black. I have a UIActivityIndicator setup to show that the address is loading, but I don't know how to prevent it from seeming as if the application is not responding, and I don't want to show t...