登录 ,注册 界面实现 代码
//1、账号标签
UILabel *idLalel = [[UILabel alloc] initWithFrame:CGRectMake(30, 100, 70, 30)];
//2、设置⽂文本控制相关的属性
idLalel.text = @"账号:";
[self addSubview:idLalel];
[idLalel release];
//1、密码标签
UILabel *passLalel = [[UILabel alloc] initWithFrame:CGRectMake(30, 200, 70, 30)];
//2、设置⽂文本控制相关的属性
passLalel.text = @"密码:";
[self addSubview:passLalel];
[passLalel release];
//账号输入框
UITextField *idTexfield = [[UITextField alloc] initWithFrame:CGRectMake(100, 100, 160, 30)];
//设置边界属性
idTexfield.tag = 1001;
idTexfield.borderStyle = UITextBorderStyleBezel;
idTexfield.placeholder = @"请输入账号...";
idTexfield.delegate = self;
[self addSubview:idTexfield];
[idTexfield release];
//密码输入框
UITextField *passTexfield = [[UITextField alloc] initWithFrame:CGRectMake(100, 200, 160, 30)];
//设置边界属性
passTexfield.tag = 1002;
passTexfield.borderStyle = UITextBorderStyleBezel;
passTexfield.secureTextEntry = YES; //以圆点形式输入
passTexfield.keyboardType = UIKeyboardTypeNumberPad;//键盘形式
passTexfield.returnKeyType = UIReturnKeyNext;
passTexfield.placeholder = @"请输入密码...";
passTexfield.delegate = self;
[self addSubview:passTexfield];
[passTexfield release];
//放置按钮
//登录
UIButton *loginButton = [UIButton buttonWithType:UIButtonTypeSystem];
loginButton.frame = CGRectMake(30, 250, 60, 30);
[loginButton setTitle:@"登录" forState:UIControlStateNormal];
//添加事件
[loginButton addTarget:self action:@selector(loginAction:)
forControlEvents:UIControlEventTouchUpInside];
[self addSubview:loginButton];
//注册
UIButton *registerButton = [UIButton buttonWithType:UIButtonTypeSystem];
registerButton.frame = CGRectMake(120, 250, 60, 30);
[registerButton setTitle:@"注册" forState:UIControlStateNormal];
// [loginButton addTarget:self action:@selector(login:)
// forControlEvents:UIControlEventTouchUpInside];
[self addSubview:registerButton];
//密码找回
UIButton *regetButton = [UIButton buttonWithType:UIButtonTypeSystem];
regetButton.frame = CGRectMake(220, 250, 60, 30);
[regetButton setTitle:@"密码找回" forState:UIControlStateNormal];
// [loginButton addTarget:self action:@selector(login:)
// forControlEvents:UIControlEventTouchUpInside];
[self addSubview:regetButton];