黑马程序员——iOS 开发学习---登录注册页面跳转
2016-01-11 10:39
776 查看
——Java培训、Android培训、iOS培训、.Net培训、期待与您交流! ——-
.h
.m
.h
{ UIView *_view; UIView *image2; UITextField *_text; UITextField *_enter; UITextField *_registered; UIButton *_button3; }
.m
- (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]; _view=[[UIView alloc]initWithFrame:CGRectMake(0, 0, 320, 480)]; _view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"1.png"]]; [self.window addSubview:_view]; image2=[[UIView alloc]initWithFrame:CGRectMake(0, 0, 320, 480)]; image2.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"2.jpg"]]; _enter=[[UITextField alloc]initWithFrame:CGRectMake(80, 110, 170, 30)]; _enter.backgroundColor=[UIColor grayColor]; _enter.placeholder=@"密码:"; _enter.textColor=[UIColor blackColor]; _enter.secureTextEntry=YES;//输入安全 _enter.clearButtonMode=YES;//出现小叉,点击消除输入框所有文字 [_view addSubview:_enter]; _registered=[[UITextField alloc]initWithFrame:CGRectMake(80, 70, 170, 30)]; _registered.backgroundColor=[UIColor grayColor]; _registered.placeholder=@"账号:"; _registered.textColor=[UIColor blackColor]; _registered.clearButtonMode=YES; [_view addSubview:_registered]; for (int i=0; i<=6; i++) { _text=[[UITextField alloc]initWithFrame:CGRectMake(80, 35+50*i, 200, 40)]; _text.backgroundColor=[UIColor grayColor]; _text.clearButtonMode=YES; //[_textField becomeFirstResponder]; [image2 addSubview:_text]; } for (int i=0; i<=6; i++) { UILabel *lable=[[UILabel alloc]initWithFrame:CGRectMake(10, 35+50*i, 60, 40)]; lable.backgroundColor=[UIColor grayColor]; lable.text=@".0.0."; [image2 addSubview:lable]; } UIButton *button1=[UIButton buttonWithType:UIButtonTypeCustom]; button1.frame=CGRectMake(50, 350, 80, 30); button1.showsTouchWhenHighlighted=YES; button1.backgroundColor=[UIColor grayColor]; [button1 setTitle:@"登陆" forState:UIControlStateNormal]; [button1 setTitleColor:[UIColor blueColor] forState:UIControlStateHighlighted]; [_view addSubview:button1]; UIButton *button2=[UIButton buttonWithType:UIButtonTypeCustom]; button2.frame=CGRectMake(320-(50+80), 350, 80, 30); button2.showsTouchWhenHighlighted=YES; button2.userInteractionEnabled=YES; button2.backgroundColor=[UIColor grayColor]; [button2 setTitle:@"注册" forState:UIControlStateNormal]; [button2 setTitleColor:[UIColor blueColor] forState:UIControlStateHighlighted]; [button2 addTarget:self action:@selector(registered) forControlEvents:UIControlEventTouchDown]; [_view addSubview:button2]; _button3=[UIButton buttonWithType:UIButtonTypeCustom]; _button3.frame=CGRectMake(110, 400, 100, 30); _button3.showsTouchWhenHighlighted=YES; _button3.userInteractionEnabled=YES; _button3.backgroundColor=[UIColor grayColor]; [_button3 setTitle:@"返回登陆页" forState:UIControlStateNormal]; [_button3 setTitleColor:[UIColor blueColor] forState:UIControlStateHighlighted]; [_button3 addTarget:self action:@selector(back) forControlEvents:UIControlEventTouchDown]; [image2 addSubview:_button3]; return YES; } -(void)registered { [_view canBecomeFirstResponder]; [self.window addSubview:image2]; } -(void)back { [image2 canBecomeFirstResponder]; [self.window addSubview:_view]; } //消除键盘 - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { [_enter resignFirstResponder]; [_registered resignFirstResponder]; // [_text resignFirstResponder]; [self.window endEditing:YES]; }
相关文章推荐
- 三招搞定群体面试
- 面试题3:二维数组中的查找
- 我是如何准备ThoughtWorks面试的
- 程序员
- 程序员遇到BUG后,最好的方法是?
- ios面试题(附答案)
- 这个寒冬,如何赶走职场之“霾”
- 面试题
- 黑马程序员——正则篇
- 有人说中文编辑是解决中国程序员编程效率的秘密武器,请问他是一个银弹吗?
- 黑马程序员——数组篇
- 面试经历---广州金砖信息技术有限公司(2015年11月25日上午面试)
- 面试经历---YY欢聚时代(2015年11月21日上午初试、25日下午复试)
- android 面试题
- .NET反编译的九大金刚
- 每一个程序员都应当了解的11句话
- 「程序员思维训练」2. 具体计划
- 截止2016年1月已取消的207项职业资格许可和认定事项
- LeetCode208. Implement Trie (Prefix Tree)实现前缀树
- [java面试]宇信易诚 广州分公司 java笔试题目回顾录