gpt4 book ai didi

ios - 用于询问用户评论和评分的自定义警报 View

转载 作者:行者123 更新时间:2023-11-29 03:01:25 25 4
gpt4 key购买 nike

我想做这样的事情:我想提示一个警报 View ,但在该警报 View 内我想添加一些标签,文本字段和星号[用于评级]。我如何在 iOS.i 中做到这一点我正在使用 iOS 7。我对此真的很陌生。我在我的 Android 应用程序中做到了这一点。但我不知道如何在这里做同样的事情。

在我的应用程序中,我正在使用storyboards。我有一个关于设计自定义 View 并将其加载到警报 View 中的想法。但我不知道天气是否可以完成。请有人帮助我。

谢谢。

最佳答案

  • 不能将任何 CustomView 直接添加到 UIALertView。
  • 对于 alertView,有一个属性“accesseryView”。通过使用它,我们可以将任何 UIView 添加到 UIAlertView。

    -(void)customAlertView{

    UIAlertView *Alert = [[UIAlertView alloc] initWithTitle:@"your Title" message:@"Your    

    Message" delegate:nil cancelButtonTitle:@"Your Button Title" otherButtonTitles:nil];

    NSArray *subviewArray = [[NSBundle mainBundle] loadNibNamed:@"MyCustomViewOnAlert"  owner:self options:nil];
    MyCustomViewOnAlert *myView = (MyCustomViewOnAlert*) [subviewArray objectAtIndex:0];

    [Alert setValue:myView forKey:@"accessoryView"];

    [Alert show];

    }

  • 在 XIB 上创建了一个自定义 View “MyCustomViewOnAlert”。

试试这个

关于ios - 用于询问用户评论和评分的自定义警报 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23265940/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com