我的应用程序最近因使用私有(private) API 而被拒绝(UIAlertView
的 addTextField:
方法,我可以补充一下,该方法非常有用)。
对于 UIAlertView
未记录的 addTextFieldWithValue:label:
是否有任何非私有(private)替代方案?
提前非常感谢!
最佳答案
创建文本字段作为 UIAlertView 的 subview
// Ask for Username and password.
alertView = [[UIAlertView alloc] initWithTitle:_title message:@"\n \n \n" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK", nil];
// Adds a username Field
utextfield = [[UITextField alloc] initWithFrame:CGRectMake(12.0, 45.0, 260.0, 25.0)];
utextfield.placeholder = @"Username";
[utextfield setBackgroundColor:[UIColor whiteColor]];
utextfield.enablesReturnKeyAutomatically = YES;
[utextfield setReturnKeyType:UIReturnKeyDone];
[utextfield setDelegate:self];
[alertView addSubview:utextfield];
// Show alert on screen.
[alertView show];
[alertView release];
关于iphone - 有没有非私有(private) API 替代方案?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3784134/