码迷,mamicode.com
首页 > 其他好文 > 详细

导航控制器

时间:2014-07-19 00:03:00      阅读:324      评论:0      收藏:0      [点我收藏+]

标签:des   blog   http   os   2014   io   

//

//  FirstViewController.m

//  egg break

//

//  Created by apple on 14-7-16.

//  Copyright (c) 2014年 apple. All rights reserved.

//

 

#import "FirstViewController.h"

#import "SecondViewController.h"

@interface FirstViewController ()

{  //建立全局对象

    UIImageView *Bg1;

    UIImageView *Bg2;

    

}

 

 

@end

 

@implementation FirstViewController

 

- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil

{

    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];

    if (self) {

        // Custom initialization

    }

    return self;

}

 

//创建背景

-(void)BgView

{

    Bg1=[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 320, 480)];

    Bg1.image=[UIImage imageNamed:@"bg_01"];

    [self.view addSubview:Bg1];

    

    

    Bg2=[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 320, 480)];

    Bg2.image=[UIImage imageNamed:@"bg_01_01"];

    [self.view addSubview:Bg2];

}

 

 

//建立侯爷

- (void)viewDidLoad

{

    [super viewDidLoad];

    [self BgView];

    UIButton *Btn=[UIButton buttonWithType:UIButtonTypeCustom];

    [Btn setImage:[UIImage imageNamed:@"H42_practice_nu"] forState:UIControlStateNormal];

    [Btn addTarget:self action:@selector(Click:) forControlEvents:UIControlEventTouchUpInside];

 

    Btn.frame=CGRectMake(0, 100, 50, 50);

    [self.view addSubview:Btn];

    

    UIButton *Btn1=[UIButton buttonWithType:UIButtonTypeCustom];

    [Btn1 setImage:[UIImage imageNamed:@"H63_practice_me"] forState:UIControlStateNormal    ];

    [Btn1 addTarget:self action:@selector(Click1:) forControlEvents:UIControlEventTouchUpInside];

    Btn1.frame=CGRectMake(100, 100, 50, 50);

    [self.view addSubview:Btn1];

    self.navigationController.navigationBarHidden=YES;

    

    

    

    // Do any additional setup after loading the view.

}

 

 

 

//建立按键

-(void)Click:(UIButton *)sender

{

    SecondViewController *Sec=[[SecondViewController alloc]init];

    Sec.title=@"1";

    Sec.Name=@"1";

    [self.navigationController pushViewController:Sec animated:YES];

}

 

-(void)Click1:(UIButton *)sender

{

    SecondViewController *Sec=[[SecondViewController alloc]init];

    Sec.title=@"2";

    Sec.Name=@"2";

    [self.navigationController pushViewController:Sec animated:YES];

 

}

 

- (void)didReceiveMemoryWarning

{

    [super didReceiveMemoryWarning];

    

// Dispose of any resources that can be recreated.

}

 

/*

#pragma mark - Navigation

 

// In a storyboard-based application, you will often want to do a little preparation before navigation

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender

{

    // Get the new view controller using [segue destinationViewController].

    // Pass the selected object to the new view controller.

}

*/

 

@end

 bubuko.com,布布扣

导航控制器,布布扣,bubuko.com

导航控制器

标签:des   blog   http   os   2014   io   

原文地址:http://www.cnblogs.com/niang123/p/3849842.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!