基础控件的使用
来源:互联网 发布:mac osx 10.12 编辑:程序博客网 时间:2024/06/08 11:19
_inputTextField= [[UITextField alloc] initWithFrame:CGRectMake(100, 20, 130, 30)]; _inputTextField.placeholder = @"请输入!!"; _inputTextField.textAlignment = NSTextAlignmentLeft; _inputTextField.borderStyle = UITextBorderStyleLine; _inputTextField.delegate = self; [self.window addSubview:_inputTextField]; [_inputTextField release]; UIButton * backButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; backButton.frame = CGRectMake(100, 50, 100, 30); [backButton addTarget:self action:@selector(didClickBackButtonAction) forControlEvents:UIControlEventTouchUpInside]; [backButton setTitle:@"回收" forState:UIControlStateNormal]; [self.window addSubview:backButton]; return YES;}- (BOOL)textFieldShouldReturn:(UITextField *)textField{ NSLog(@"%s",__FUNCTION__); [textField resignFirstResponder]; return YES;}-(void)didClickBackButtonAction{ //输入取消第一响应者 //[_inputTextField resignFirstResponder]; UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:@"提示" message:@"需要回收键盘吗?" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil]; [alertView show]; [alertView release];}//appdelegate对象作为UIAlertView的代理,通过实现协议方法,获取信息-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{ //执行方法 NSLog(@"%s",__FUNCTION__); NSLog(@"Button index = %d",buttonIndex); if (buttonIndex == 1) { [_inputTextField resignFirstResponder]; }else { NSLog(@"取消回收!"); }}-(void)alertViewCancel:(UIAlertView *)alertView{ NSLog(@"%s",__FUNCTION__);}// //返回一个BOOL值,指定是否开始编辑- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField{ return YES;}
0 0
- 基础控件的使用
- studio基础控件的使用
- 006.高级控件的使用(基础--案例)
- 对话框程序基础控件的使用
- UI基础控件的使用1
- IOS的基本控件的使用-UIViewController基础
- wicket基础应用(2)--wicket表单控件的使用
- VS.NET windows编程基础之ListBox控件的使用
- iPhone基础开发之switch控件的使用
- Android基础控件之Button的基本使用
- Android基础控件之Button的基本使用(转)
- 4.MFC Tab控件的使用基础实例
- Android基础控件之Button的基本使用
- Android基础控件之Button的基本使用
- Android Studio开发基础之AutoCompleteTextView控件的使用
- Cocos2d-JS项目之二:cocostudio基础控件的使用
- UI基础----常见控件的使用之TextView
- UI基础----常见控件的使用之EditText
- POSIX 共享内存
- 2C03-View-Layout-Animation-list-Reverse-Order
- Extjs4 动态生成图表chart(从后台传数据动态显示)
- MediaCoder字幕乱码问题
- Wing IDE pro 5.0.0-1版本破解方法(仅供测试,请使用正版软件)
- 基础控件的使用
- jQuery开始
- css3-rotate实现超炫环形旋转特效
- Java 字符串算术表达式求值
- 深入理解win7的UAC
- js监听输入框值的即时变化onpropertychange、oninput
- jQuery选择器整理
- LeetCode: First Missing Positive [040]
- 台湾“奇葩”租屋广告:限单身女性 胸要大(图)