6

我想UITableView在警报视图中添加。

我试图添加一个表格视图作为警报视图的子视图,它不起作用。你能给我一些代码或示例链接吗?

我怎样才能做到这一点?

4

5 回答 5

8

尝试以下任一页面:

http://zpasternack.blogspot.com/2010/10/stupid-uialertview-tricks-part-deux.html

https://github.com/blommegard/SBTableAlert

于 2011-07-22T14:41:42.360 回答
5

它在我的情况下工作

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"title" message:@"click for submission \n\n\n\n "delegate:self  cancelButtonTitle:@"click for submission"
otherButtonTitles:nil];

    table = [[UITableView alloc]initWithFrame:CGRectMake(10, 40, 264, 120)];
    table.delegate = self;
    table.dataSource = self;
    [alert addSubview:table];

    [alert show];

    [table release];

    [alert release];        
于 2012-07-04T10:52:15.533 回答
3

这真的是你想要的吗?

警报非常突兀,并且对用户来说非常令人担忧。警报是模态的,应谨慎使用。也许其中一个可能是更好的解决方案:

  • 导航到带有表格视图中选项的新屏幕。像大多数设置应用程序一样。
  • 使用 UISegmentedControl,例如在 WiFi 网络的设置中。
  • 如果在 iPad 上,则在 UIPopoverController 中有选项。
  • 改写选项,使 UISwitch 成为逻辑控件。
于 2011-07-22T15:08:29.737 回答
2

而不是UIAlertView + UITableView使用UIActionSheet更好。

于 2013-02-22T07:24:31.860 回答
0

您可以对 tableView 列表和 datePicker使用 CAAlertView“ https://github.com/chandanankush/CAAlertView ”

于 2013-03-11T11:30:27.937 回答