Lal*_*ith 0 iphone uitableview ios
我使用以下代码以编程方式选择tableview单元格
- (void) selectTableCell{
NSIndexPath *ip = [NSIndexPath indexPathForRow:0 inSection:0];
[tableView selectRowAtIndexPath:ip animated:YES scrollPosition:UITableViewScrollPositionBottom];
NSIndexPath *ip1 = [NSIndexPath indexPathForRow:1 inSection:0];
[tableView selectRowAtIndexPath:ip1 animated:YES scrollPosition:UITableViewScrollPositionBottom];}
Run Code Online (Sandbox Code Playgroud)
出于测试目的,我想这样做.如何生成didselect事件?
谢谢,拉利思
文档明确告诉您发生了什么:
调用此方法不会导致委托接收
tableView:willSelectRowAtIndexPath:或tableView:didSelectRowAtIndexPath:发送消息,也不会UITableViewSelectionDidChangeNotification向观察者发送通知.
您可以尝试自己调用这些方法,但不保证会复制原始功能.
要测试UI,您应该尽可能使用基于仪器的UI自动化测试.
我想这应该有效:
if ([tableView.delegate respondsToSelector:@selector(tableView:didSelectRowAtIndexPath:)]) {
[tableView.delegate tableView:tableView didSelectRowAtIndexPath:ip];
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1705 次 |
| 最近记录: |