现在的位置: 首页 > 综合 > 正文

(柯昌合)IOS实现界面切换(柯昌合)

2013年10月03日 ⁄ 综合 ⁄ 共 1356字 ⁄ 字号 评论关闭

//代理类代码

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary
*)launchOptions

{

    self.window = [[[UIWindowalloc]
initWithFrame:[[UIScreenmainScreen]
bounds]]autorelease];

    // Override point for customization after application launch.

    self.window.backgroundColor = [UIColorwhiteColor];

    [self.windowmakeKeyAndVisible];

    

    RootViewController *rootViewController=[[RootViewControlleralloc]
init];

   UINavigationController *uiNavigationController=[[UINavigationControlleralloc]
initWithRootViewController:rootViewController];

   self.window.rootViewController=uiNavigationController;

    

    return
YES;

}

//UIViewController代码

-(void) loadView{

    

    UIView *baseView=[[UIViewalloc]
initWithFrame:[[UIScreenmainScreen]applicationFrame]];

    baseView.backgroundColor=[UIColororangeColor];

   self.view=baseView;

    [baseViewrelease];

   

   UIButton *btnShowSecond=[[UIButtonalloc]
initWithFrame:CGRectMake(100,100,
50, 20)];

    [btnShowSecond setTitle:@"show"forState:UIControlStateNormal];

    [btnShowSecond addTarget:selfaction:@selector(showVC)forControlEvents:UIControlEventTouchUpInside];

    //btnShowSecond.backgroundColor=[UIColor blueColor];

    [self.viewaddSubview:btnShowSecond];

    

}

-(void)showVC{

    SecondViewController *secondViewController=[[SecondViewControlleralloc]
init];

    [self.navigationControllerpushViewController:secondViewController
animated:YES];

    [selfrelease];

}

抱歉!评论已关闭.