UILabel *idLabel = [[UILabel alloc] initWithFrame:CGRectMake(50.0, 50.0, 50.0, 30.0)];
idLabel.text = @"ID";
[idLabel setBackgroundColor:[UIColor clearColor]];
idLabel.textAlignment = UITextAlignmentCenter;
UILabel *pwLabel = [[UILabel alloc] initWithFrame:CGRectMake(50.0, 90.0, 50.0, 30.0)];
pwLabel.text = @"PW";
[pwLabel setBackgroundColor:[UIColor clearColor]];
pwLabel.textAlignment = UITextAlignmentCenter;
UITextField *idTextField = [[UITextField alloc] initWithFrame:CGRectMake(110.0, 50.0, 100.0, 30.0)];
idTextField.borderStyle = UIButtonTypeRoundedRect;
idTextField.returnKeyType = UIReturnKeyDone;
idTextField.delegate = self;
[idTextField addTarget:self action:@selector(EndEditing:) forControlEvents:UIControlEventEditingDidEndOnExit];
UITextField *pwTextField = [[UITextField alloc] initWithFrame:CGRectMake(110.0, 90.0, 100.0, 30.0)];
pwTextField.returnKeyType = UIReturnKeyDone;
pwTextField.borderStyle = UIButtonTypeRoundedRect;
pwTextField.delegate = self;
[pwTextField addTarget:self action:@selector(EndEditing:) forControlEvents:UIControlEventEditingDidEndOnExit];
UIButton *cancelButton = [self CreateButton:@"Cancel" type:UIButtonTypeRoundedRectview:self.view
frame:CGRectMake(50.0, 130.0, 75.0, 30.0) target:self action:nil];
UIButton *confirmButton = [self CreateButton:@"Confirm" type:UIButtonTypeRoundedRectview:self.view
frame:CGRectMake(135.0, 130.0, 75.0, 30.0) target:self action:nil];
[self.view addSubview:idLabel];
[self.view addSubview:pwLabel];
[self.view addSubview:idTextField];
[self.view addSubview:pwTextField];
[self.view addSubview:cancelButton];
[self.view addSubview:confirmButton];
--------------------------------------------------------------------------------------------
- (void)EndEditing:(id)sender
{
[sender resignFirstResponder];
}
- (UIButton *)CreateButton:(NSString *)title type:(UIButtonType)type view:(UIView *)view
frame:(CGRect)frame target:(id)target action:(SEL)action {
UIButton *button = [[UIButton buttonWithType:type] retain];
button.frame = frame;
[button setTitle:title forState:UIControlStateNormal];
[button addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
[view addSubview:button];
return button;
}