iphone - 有没有非私有(private) API 替代方案?

标签 iphone objective-c uialertview iphone-privateapi

我的应用程序最近因使用私有(private) API 而被拒绝(UIAlertViewaddTextField: 方法,我可以补充一下,该方法非常有用)。

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

相关文章:

iphone - UIButton - 我们应该释放还是不释放?

html - 尽管将其设置为 scale=1,但 Bootstrap 模型未在 iPhone 5s 的全视口(viewport)中显示

ios - 构建时错误 : Receiver type * for for instance message is a forward declaration

iphone - 在 UIViewController 中在哪里初始化一些东西

objective-c - UIActivityIndi​​catorView 未在 UIAlertView 中显示 - iOS7

ios - 访问 alertView 的调用 View

iphone - 为什么在 Objective-C 上保留属性可能不保留?

iphone - 如何以编程方式确定我的应用程序正在 iPhone、iPad 或 iPhone 4 上运行?

ios - 使用 UITableView 创建下拉菜单

ios - 尝试在已经呈现的 View Controller 上呈现 UIAlertController(空)[Swift]