将 UILabel 或 NSString 添加到 UIalertView
我想向 UIALertView 添加一堆 UILabels 或 NSString,因为我的显示器空间不足。
UIAlertView *alertDialog;
alertDialog = [[UIAlertView alloc]
initWithTitle:@"random" message:nil delegate:self cancelButtonTitle:@"Dismiss" otherButtonTitles: nil];
//firstString=[[UILabel alloc]initWithFrame: CGRectMake(12.0, 70.0, 260.0, 25.0)];
[alertDialog addSubview:firstString];
[alertDialog show];
[alertDialog release];
I would like to add a bunch of UILabels or NSStrings to the UIALertView since I have run out of space on my display.
UIAlertView *alertDialog;
alertDialog = [[UIAlertView alloc]
initWithTitle:@"random" message:nil delegate:self cancelButtonTitle:@"Dismiss" otherButtonTitles: nil];
//firstString=[[UILabel alloc]initWithFrame: CGRectMake(12.0, 70.0, 260.0, 25.0)];
[alertDialog addSubview:firstString];
[alertDialog show];
[alertDialog release];
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我可以根据经验告诉你这是一个坏主意。在早期版本或 iOS 中,存在使用未记录行为的技巧,Apple 对底层代码进行了更改,但一切都严重崩溃。只需按照您喜欢的方式创建 UIView 即可。如果您想调暗屏幕的其余部分,只需在屏幕上方和视图下方放置一个半透明视图即可。
I can tell you from experience that this is a bad idea. In earlier version or iOS there were tricks using undocumented behavior, Apple made changes to the underlaying code and it all broke badly. Just create a UIView the way you like. If you want to dim the rest of the screen just place a semi-transparenr view over the screen and under your view.
您可以使用警报视图的替代实现。第一,它不是 UIAlertView 的子类,因此它绝对独立于 Apple 可能发布的任何更改。并且您可以添加任何子视图作为干净的属性。
TSAlertView 就是这样一种替代实现。
You can use a alternative implementation of an alert view. One, that is not a subclass of UIAlertView — so it is absolutely independent to any changes Apple may release. And you have the possibility to add any subview as a clean property.
TSAlertView is such an alternative implementation.
您可以使用 uitextfield 来执行此操作,
只需将 textcolor 更改为 while ,并将背景颜色更改为 clearColor
you can use uitextfield to do so ,
simply change textcolor to while , and change background color to clearColor