iOS登陆选择主界面
- (void)viewDidLoad { //云图图片 UIImage *firstimage=[UIImage imageNamed:@"700.png"]; UIImageView *firstiamgeview=[[UIImageView alloc]initWithImage:firstimage]; [firstiamgeview setFrame:CGRectMake(100, 150, 100, 100)]; [self.view addSubview:firstiamgeview]; //登录按钮 UIButton *login=[UIButton buttonWithType:UIButtonTypeRoundedRect]; [login setTitle:@"登陆" forState:UIControlStateNormal]; [login setFrame:CGRectMake(50, 300, 200, 50)]; [login addTarget:self action:@selector(loginclicked:) forControlEvents:UIControlEventTouchUpInside]; login.backgroundColor=[UIColor blueColor]; //注册按钮 UIButton *Register=[UIButton buttonWithType:UIButtonTypeRoundedRect]; [Register setTitle:@"注册" forState:UIControlStateNormal]; [Register setFrame:CGRectMake(50, 370, 200, 50)]; [Register addTarget:self action:@selector(registerclicked:) forControlEvents:UIControlEventTouchUpInside]; Register.backgroundColor=[UIColor blueColor]; [self.view addSubview:Register]; [self.view addSubview:login]; [super viewDidLoad]; // Do any additional setup after loading the view. } -(void)registerclicked:(UIButton*)Register { RegisterViewController *registermian=[[RegisterViewController alloc]init]; [self.navigationController pushViewController:registermian animated:YES]; } -(void)loginclicked:(UIButton*)login { loginViewController *loginmain=[[loginViewController alloc]init]; [self.navigationController pushViewController:loginmain animated:YES]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. }
不为失败找原因,要为成功找方法!