IOS_Sheet_TextFeild_学习记录
2014-05-22 22:48
288 查看
#import "LoginViewController.h"
@interface LoginViewController ()<UITextFieldDelegate,UIActionSheetDelegate>
@property (weak, nonatomic) IBOutlet UITextField *name;
@property (weak, nonatomic) IBOutlet UITextField *password;
@end
@implementation LoginViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)login:(id)sender {
NSString *name = self.name.text;
NSString *password = self.password.text;
if ([name isEqualToString:@"admin"] && [password isEqualToString:@"admin"]) {
UIActionSheet *actionsheet = [[UIActionSheet alloc] initWithTitle:@"登录成功"
delegate:self
cancelButtonTitle:@"取消"
destructiveButtonTitle:@"确定"
otherButtonTitles:@"其他", nil];
[actionsheet showInView:self.view];
}
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField{
[textField resignFirstResponder];
return true;
}
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"登陆"
message:@"输入用户名密码"
delegate:self
cancelButtonTitle:@"取消"
otherButtonTitles:@"确定",nil];
alert.alertViewStyle = UIAlertViewStyleLoginAndPasswordInput;
[alert show];
}
@end
@interface LoginViewController ()<UITextFieldDelegate,UIActionSheetDelegate>
@property (weak, nonatomic) IBOutlet UITextField *name;
@property (weak, nonatomic) IBOutlet UITextField *password;
@end
@implementation LoginViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)login:(id)sender {
NSString *name = self.name.text;
NSString *password = self.password.text;
if ([name isEqualToString:@"admin"] && [password isEqualToString:@"admin"]) {
UIActionSheet *actionsheet = [[UIActionSheet alloc] initWithTitle:@"登录成功"
delegate:self
cancelButtonTitle:@"取消"
destructiveButtonTitle:@"确定"
otherButtonTitles:@"其他", nil];
[actionsheet showInView:self.view];
}
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField{
[textField resignFirstResponder];
return true;
}
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"登陆"
message:@"输入用户名密码"
delegate:self
cancelButtonTitle:@"取消"
otherButtonTitles:@"确定",nil];
alert.alertViewStyle = UIAlertViewStyleLoginAndPasswordInput;
[alert show];
}
@end
相关文章推荐
- IOS学习之UIActionSheet的使用
- iOS学习之UIActionSheet的使用
- iOS学习笔记: 错误记录
- ios学习记录 day1
- IOS与Objective-C学习记录(一)
- 【斯坦福大学公开课Developing Applications for iOS Fall 2011】学习记录之一
- ios学习记录 day5
- 今天开通博客,记录我作为一个小菜鸟在iOS学习中的点点滴滴
- ios学习之常见问题记录
- ios学习记录 day3
- 开始学习 IOS 开发,记录学习笔记。
- ios学习记录-UITableView
- 【iOS学习】----UIActionSheet
- ios学习笔记之UI篇(三):操作表单(action sheet)和警告(alert)
- 【IOS实例小计】今日开贴,记录我的ios学习生涯,留下点滴,留下快乐,成荫后人。
- IOS学习4 UIActionSheet的使用
- HTML5,CSS3与Javascript,iOS下基础WebApp学习经验记录(2)
- iOS学习之UIActionSheet的使用
- iOS学习之UIActionSheet的使用
- ios学习记录 day4