本文介绍了将TableViewCell推送到另一个ViewController时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图将数据从TableViewCell传递到另一个ViewController.但是没有数据显示在另一个ViewController中.这是我的代码
I trying to pass the data from TableViewCell to the another ViewController.But No data Displaying in the another ViewController.here is my Code
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
PeripheralManager *objSelected=[device objectAtIndex:indexPath.row];
[self prepareForSegue:@"TableDetails" sender:objSelectedDevice];
}
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString:@"TableDetails"])
{
DetailViewController *detail=segue.destinationViewController;
detail.dataArray=device;
}
}
错误消息
nested push animation can result in corrupted navigation bar
2012-10-24 12:01:39.805 [3182:707] nested push animation can result in corrupted navigation bar
2012-10-24 12:01:40.164 [3182:707] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
2012-10-24 12:01:40.167 [3182:707] Finishing up a get navigation transition in an unexpected state. Navigation Bar subview tree might corrupted.
推荐答案
删除您的多余代码仅这样做-
Remove your extra code Only do this-
在DetailViewController.h
@property(nonatomic, retain)NSMutableArray *dataArray;
在DetailViewController.m
@synthesize dataArray = _dataArray;
现在在TableViewController.m
中,只需编写此内容-
Now In TableViewController.m
Just write this -
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if([segue.identifier isEqualToString:@"TableDetails"])
{
DetailViewController *detailViewObject = segue.destinationViewController;
detailViewObject.dataArray = anyArray;
}
}
我在这里通过NSMutableArray
.
这篇关于将TableViewCell推送到另一个ViewController时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!