Help please - dynamically change background image in iphone app

Discussion in 'iOS Programming' started by afruj, Jul 21, 2009.

  1. afruj macrumors newbie

    Jul 21, 2009
    I'm developing an iphone applications with multiple views. my main view has 6 buttons to display detail view on topics. I have a NSInteger variable named intDetails which contain an integer value - set from main view. Based on this value details screen display a background image and animation. the background image have to load while the view load. after display the details view if user click on 'Animation' button the corresponding animation will play with sound. it works fine. But the problem is I fail to change background image while load view. From -
    (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
        if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
                   intLetter = 1;//if I give value the corresponding bg display
    I can get the value set from main view anywhere the class. But from upper function it get null value and failed to change background image according intLetter value. Please help me. Today I have to fix this bug.
  2. PhoneyDeveloper macrumors 68040


    Sep 2, 2008
    Implement this in viewDidLoad. self.view doesnt exist when initWithNibName is executed.

Share This Page