-1

我有一个习惯UIViewtextfield和。我想将此自定义添加到屏幕上显示。我可以这样做吗?谢谢buttonUIWebViewUIViewUIAlertView

4

4 回答 4

3

您确实可以这样做,但是您的应用程序将被拒绝,如Apple的人机界面指南中所述。如果您仍然想这样做,那么就[alertView addSubview:view];可以了。

我建议您制作自己的 UIAlertView,但与 UIAlertView 中的外观相比,它具有更统一的设计和更好的用户体验。

于 2013-07-19T09:09:20.053 回答
1

为什么要在自定义警报视图中添加和显示。您可以在子视图中显示它并使用 addSubview: 方法显示它

请注意,alertview 的目的是呈现警报,它本身就是唯一的目的。 UIView 的存在是为了呈现它

于 2013-07-19T09:08:46.127 回答
0

是的,您可以添加,需要设置适当的框架以及视图上的按钮操作之类的所有内容。

 UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"test" message:@"\n\n\n\n\n\n\n\n\n\n\n" delegate:self cancelButtonTitle:nil otherButtonTitles:nil, nil];
    UIView *view= [[UIView alloc]initWithFrame:CGRectMake(0, 0, 300, 300)];
    view.backgroundColor = [UIColor redColor];
    [alert addSubview:view];
    [alert show];
于 2013-07-19T09:08:13.483 回答
0

试试这个代码,我正在添加标签。

delegate.alert=[[UIAlertView alloc]initWithTitle:@"Password" message:@"\n\n\n\n\n" delegate:self cancelButtonTitle:nil otherButtonTitles:nil, nil];

    delegate.lbl=[[UILabel alloc]init];
    delegate.lbl.frame=CGRectMake(60, 42, 200, 18);

    delegate.lbl.backgroundColor=[UIColor clearColor];
    [delegate.alert addSubview:delegate.lbl];

无论您如何控制,都可以像这样添加,但只能正确设置框架...根据您的需要..

于 2013-07-19T09:25:11.167 回答