【发布时间】:2012-10-29 10:10:49
【问题描述】:
抱歉,我是 iOS 新手。我打算在UIAlertView 中创建一个UITableView。最后我得到了this tutorial
我已经以这种方式实现了UIAlertTableView 类
UIAlertTableView *alert = [[UIAlertTableView alloc] initWithTitle:@"Choose a number"
message:nil
delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles:nil, nil];
alert.tableDelegate = self;
alert.dataSource = self;
alert.tableHeight = 120;
[alert show];
但是经过测试,我得到 UIAlert 显示一个空白列表,里面没有任何项目出现。以前我有一个我想用作数据源的 NSMUtableArray。从上面的教程来看,似乎分配数据源是使用alert.dataSource = self 完成的。但是我仍然想知道如何使用我的 NSMutableArray 作为数据源以及它与alert.dataSource 的关系?
【问题讨论】:
-
您可能需要为 tableview 实现数据源和委托方法。
标签: ios uitableview nsmutablearray datasource uialertview