Wednesday 18 December 2013

Programmatically set root view controller in iphone

DemoDelegate.h


@class second;

@property (strong, nonatomic) second *s;

DemoDelegate.m


#import "second.h"
@synthesize s;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.
    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];
   
    s = [[second alloc]initWithNibName:@"second" bundle:nil];
    self.window.rootViewController = s;
   
   
    return YES;
}

No comments:

Post a Comment

Comment