次のコードを使用して を作成し、UIAlertView
その上にいくつかのコンポーネントを追加しましたが、結果は画像にあります :(( (画像はこちら: http://i.stack.imgur.com/DTg02.png )
-(IBAction)login:(id)sender
{
UIAlertView *login = [[UIAlertView alloc]initWithTitle: @"Login first"
message:@"enter username and password please first" delegate:self cancelButtonTitle:@"cancel"otherButtonTitles:@"OK", nil];
k = [[UITextField alloc] initWithFrame:CGRectMake(20.0, 70.0, 200.0, 25.0)]; //<< it also displays wrong without this line
k.text = @"";
k.backgroundColor = [UIColor whiteColor];
k.clearButtonMode= UITextFieldViewModeWhileEditing;
k.keyboardType = UIKeyboardTypeAlphabet;
k.keyboardAppearance = UIKeyboardAppearanceAlert;
p = [[UITextField alloc] initWithFrame:CGRectMake(20.0, 100.0, 200.0, 25.0)];
p.text = @"";
p.backgroundColor = [UIColor whiteColor];
p.clearButtonMode = UITextFieldViewModeWhileEditing;
p.keyboardType = UIKeyboardTypeAlphabet;
p.keyboardAppearance = UIKeyboardAppearanceAlert;
[login addSubview:k];
[login addSubview:p];
[login show];
}