任何非私有API替代方案?

时间:2010-09-24 04:07:27

标签: iphone objective-c uialertview iphone-privateapi

我的应用最近因使用私有API(addTextField:的{​​{1}}方法而被拒绝,这非常有用,我可以添加)。

UIAlertView的无证UIAlertView是否有非私有替代方案?

提前多多谢谢!

2 个答案:

答案 0 :(得分:3)

将文本字段创建为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];

答案 1 :(得分:0)

在GitHub上查看这个开源代码,将UITextFields添加到UIAlertView。

http://github.com/enormego/EGOTextFieldAlertView