问题- 我想要一个 UIAlertView,它包含一个标题、两个带占位符的文本字段和两个按钮。 到目前为止我所做的- 我已经使用了这段代码,我得到了我提到的所有这些的确切 UIAlertView 但是当视图被加载时似乎首先出现在底部然后进入视图的中间。
-(void)showalert{
disclaimerAgreedAlertView = [[UIAlertView alloc] initWithTitle:@" "
message:@" "
delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles:@"Login", nil];
userNameTextField = [[UITextField alloc] initWithFrame:CGRectMake(20.0, 15.0, 245.0, 25.0)];
userNameTextField.delegate=self;
[userNameTextField setBackgroundColor:[UIColor whiteColor]];
[userNameTextField setKeyboardType:UIKeyboardTypeDefault];
userNameTextField.placeholder=@"Username";
userNameTextField.secureTextEntry=NO;
[disclaimerAgreedAlertView addSubview:userNameTextField];
passwordTextField = [[UITextField alloc] initWithFrame:CGRectMake(20.0, 45.0, 245.0, 25.0)];
passwordTextField.delegate=self;
[passwordTextField setBackgroundColor:[UIColor whiteColor]];
[passwordTextField setKeyboardType:UIKeyboardTypeDefault];
passwordTextField.placeholder=@"Password";
passwordTextField.secureTextEntry=YES;
[disclaimerAgreedAlertView addSubview:passwordTextField];
disclaimerAgreedAlertView.tag=99;
[disclaimerAgreedAlertView show];
disclaimerAgreedAlertView.frame= CGRectMake(5, 400, 320, 160);
}
然后我尝试了一些未记录的 api,它们给了我想要的结果,但我担心它可能会导致我的应用程序被拒绝。
那么,有什么解决办法吗?