【发布时间】:2012-01-06 03:43:16
【问题描述】:
我有一个自定义 UITableViewController 显示一个带有位置列表的 TableView,我在情节提要 (ios 5) 中创建了一个 segue 并给它一个标识符“SelectPlace”,它来自第一个 UITableViewController 中的一个单元格,并且应该转到下一个 UITableViewController 显示一个新的 tableview,其中包含所选位置的详细信息列表。
问题是 segue 没有执行(下一个 TableViewController 没有被推入屏幕,当前一个保持打开)即使我仔细检查了正确的标识符并设置了所有内容。 我什至看到(断点) -prepareForSegue 发生并成功完成。
我也试过添加
[self performSegueWithIdentifier:@"SelectPlace" sender:[self.tableView cellForRowAtIndexPath:indexPath]];
到单元格选择
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
但这并没有帮助(而且我认为这没有必要,因为情节是在情节提要上绘制的)
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
NSLog([segue.identifier description]);
if ([segue.identifier isEqualToString:@"SelectPlace"])
{
NSArray* placePhotosArr = [FlickrFetcher photosInPlace:[self.topPlacesArray objectAtIndex:([self.tableView indexPathForCell:sender].row)] maxResults:50];
[segue.destinationViewController setPlacePhotosArray:placePhotosArr];
//[segue perform];
NSLog([placePhotosArr description]);
}
}
缺少什么??? 请帮忙
【问题讨论】:
-
您上面的代码帮助解决了我的问题。感谢您发回您做错了什么! :)
标签: objective-c ios xcode uitableview segue