Loading viewcontroller from button tap?

Discussion in 'iOS Programming' started by RobertD63, Apr 19, 2010.

  1. RobertD63 macrumors 6502

    Joined:
    Feb 17, 2008
    Location:
    A place
    #1
    I'm back with another question. (Of course I am.. haha) I'm in the middle of a tutorial (iTennis) and insted of the splash view I want to load a xib that will let me load different difficulties. I have the xib load correctly and have all of the buttons hooked and everything correctly. I'm just wondering how would I implement when they tap the button they will load the correct view controller?
    Heres what I have for the first view that comes up:
    Code:
    @interface SplashViewController : UIViewController {
    	IBOutlet UIButton *easy;
    	IBOutlet UIButton *medium;
    	IBOutlet UIButton *hard;
    	IBOutlet UIButton *cantBeat;
    
    }
    @property (nonatomic, retain) IBOutlet UIButton *easy;
    @property (nonatomic, retain) IBOutlet UIButton *medium;
    @property (nonatomic, retain) IBOutlet UIButton *hard;
    @property (nonatomic, retain) IBOutlet UIButton *cantBeat;
    
    -(IBAction)easyClicked;
    -(IBAction)mediumClicked;
    -(IBAction)hardClicked;
    -(IBAction)cantBeatClicked;
    
    
    @end
    
    Code:
    @implementation SplashViewController
    @synthesize easy,medium,hard,cantBeat;
    
    
    -(IBAction)easyClicked {
    	
    	
    }
    
    -(IBAction)mediumClicked{
    		
    	
    }
    
    -(IBAction)hardClicked{
    	
    	
    }
    
    -(IBAction)cantBeatClicked{
    		
    	
    }
    
    //more code..
    
    I was looking it up in the Apple documentation and from what I see there isn't anything I can use or find helpful. I cant load from multiple xibs because I have one xib layout for multiple viewcontrollers. Any help is great :)
     
  2. MrCrispy macrumors member

    MrCrispy

    Joined:
    Apr 10, 2008
    Location:
    Jacksonville, Florida
    #2
    I'm not at the point where I can remember the exact code off the top of my head but if I recall correctly the Utility App template does, essentially, what you're looking to do. Create a blank one and see if that helps you any.
     
  3. ulbador macrumors 68000

    ulbador

    Joined:
    Feb 11, 2010
    #4
    You are correct. The utility code template in XCode does exactly this, creates a "FlipSide" view, which is pretty much what he wants to do
     
  4. MrCrispy macrumors member

    MrCrispy

    Joined:
    Apr 10, 2008
    Location:
    Jacksonville, Florida
    #5
    oh good! Looks like I can hold off on ordering that senility medication for a bit.
     

Share This Page