IPhone之自定义弹出窗口
2012-05-29 18:26
281 查看
初始化代码:
if (!_alertView) { _alertView = [[UIAlertView alloc] initWithTitle:title message:@"\n\n\n" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"登录", nil]; _alertView.delegate = self; usernameField = [[UITextField alloc] initWithFrame:CGRectMake(12.0, 50.0, 260.0, 25.0)]; usernameField.delegate = self; usernameField.placeholder = @"用户名"; usernameField.autocapitalizationType = UITextAutocapitalizationTypeNone; usernameField.autocorrectionType = UITextAutocorrectionTypeNo; usernameField.returnKeyType = UIReturnKeyNext; usernameField.keyboardType = UIKeyboardTypeEmailAddress; [usernameField setBackgroundColor:[UIColor whiteColor]]; [_alertView addSubview:usernameField]; passwordField = [[UITextField alloc] initWithFrame:CGRectMake(12.0, 85.0, 260.0, 25.0)]; passwordField.delegate = self; passwordField.placeholder = @"密码"; passwordField.secureTextEntry = YES; passwordField.returnKeyType = UIReturnKeyGo; [passwordField setBackgroundColor:[UIColor whiteColor]]; [_alertView addSubview:passwordField]; CGAffineTransform myTransform = CGAffineTransformMakeTranslation(0.0, 00.0); [_alertView setTransform:myTransform]; }else { _alertView.title = title; usernameField.text = nil; passwordField.text = nil; } [usernameField becomeFirstResponder]; [_alertView show]; |
其中didDismissWithButtonIndex参数为:第几个按钮点击事件
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex{ if (buttonIndex == 1) { self.userName = usernameField.text; self.password = passwordField.text; [self performSelector:@selector(doResponse) withObject:nil afterDelay:0.1]; } } |
相关文章推荐
- IPhone之自定义弹出窗口
- IPhone之自定义弹出窗口
- IPhone之自定义弹出窗口
- iPhone开发学习笔记004——自定义背景透明非全屏弹出窗口,子类化UIWindow
- iPhone开发学习笔记004——自定义背景透明非全屏弹出窗口,子类化UIWindow
- IPhone之自定义弹出窗口
- 在 iPhone 应用里自定义一个弹出窗口
- flex4 中创建自定义弹出窗口
- FLEX实践:自定义弹出窗口与主页面的交互(仿造EBS的LOV窗口)
- 去掉iphone连接电脑时会出现的弹出窗口
- 解决弹出的窗口window.open会被浏览器阻止的问题(自定义open方法)
- RTX面板增加自定义网址列表(新窗口弹出)
- Windows Phone 7 自定义弹出窗口
- 模仿快捷分享、从下往上弹出窗口,自定义分享菜单
- 电击图片弹出无边自定义窗口
- 快速弹出窗口的(二):自定义toast
- ASP.NET中关于验证控件和自定义弹出确认窗口的冲突问题
- Windows Phone 7 自定义弹出窗口
- 自定义Dialog 实现弹出窗口
- android 自定义POP window弹出窗口,用于信息提示