[英]pushing a DetailViewController from a table in another DetailViewController programatically
I used ShowDetailSegue
to push a DetailVewController
from another DetailViewController
. 我使用ShowDetailSegue
从另一个DetailViewController
推送了一个DetailVewController
。 there is no issues. 没有问题。 But my need is to push to a DetailedViewController
from a TableView
in another DetailedViewController
. 但是,我需要的是推到DetailedViewController
从TableView
的另一个DetailedViewController
。 I used the below code for pushing:- 我使用以下代码进行推送:
PushUpExerciseViewController *pushUpObj = [self.storyboard instantiateViewControllerWithIdentifier:@"PushUpID"];
[self presentViewController:pushUpObj animated:YES completion:nil];
After using this code in my TableView DidSelectRowAtIndexPath
the MasterViewController
is missing. 在我的TableView DidSelectRowAtIndexPath
使用此代码后,缺少MasterViewController
。 i need both Master and Detailed ViewControllers
. 我需要Master和Detailed ViewControllers
。 How to push from TableView in DetailViewController
to another DetailViewController
Programatically 如何以编程方式从DetailViewController
TableView推送到另一个DetailViewController
Simply push to View Controller. 只需按一下View Controller。
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
DetailVewController *objDetailVC = [self.storyboard instantiateViewControllerWithIdentifier:@"DetailVewController"];
//Pass the data here to DetailViewController
[self.navigationController pushViewController:objDetailVC animated:YES];
}
As you told you need to push DetailedViewController
from another DetailedViewController
instance on TableViewCell selection. 如您所知,您需要从TableViewCell选择上的另一个DetailedViewController
实例中推送DetailedViewController
。 In this case you need prevent the infinite loop of push. 在这种情况下,您需要防止推送的无限循环。
Flow 流
Master (Push) -> Detail (Push on didSelectRowAtIndexPath ) -> Detail
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.