我正在开发iOS App。当我单击CollectionView Cell将值传递给Another ViewController时。非常缓慢地将一个ViewController传递给另一个视图控制器。
MEObject *objects = [_arrayData objectAtIndex:indexPath.row];
UIWindow* window = [[UIApplication sharedApplication] keyWindow];
UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"Main" bundle: nil];
MEDetailPageViewController *view = [mainStoryboard instantiateViewControllerWithIdentifier:@"detailPage"];
[view setProduct_ID:objects.me_product_id];
window.rootViewController = view;
答案 0 :(得分:0)
在collectionview
didselectitematindexpath
方法更改代码中,如下所示:
MEObject *objects = [_arrayData objectAtIndex:indexPath.row];
MEDetailPageViewController *view = [self.Storyboard instantiateViewControllerWithIdentifier:@"detailPage"];
[view setProduct_ID:objects.me_product_id];
[self.navigationController pushViewController:view animated:YES];