我的应用最近由于使用私有API而被拒绝(addTextField:UIAlertView方法非常有用,我可以添加)。

除了UIAlertView的未记录addTextFieldWithValue:label:之外,还有其他非私有替代方法吗?

提前非常感谢!

最佳答案

创建文本字段作为UIAlertView的子视图

// 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/

10-09 01:25