dismissviewcontrolleranimated completion block 页面传值

view in B:

[self dismissViewControllerAnimated:YES completion:^{[[NSNotificationCenterdefaultCenter]postNotificationName:@"pushToSingle"object:nil userInfo:[NSDictionarydictionaryWithObject:[NSNumbernumberWithInt:post_id1]forKey:@"post_id"]];

}];

view in A:

-(void)viewWillAppear:(BOOL)animated{[[NSNotificationCenterdefaultCenter]addObserver:self selector:@selector(pushToSingle:)name:@"pushToSingle"object:nil];}-(void)pushToSingle:(NSNotification*)notis{NSDictionary*dict=notis.userInfo;intpost_id=[[dict objectForKey:@"post_id"]intValue];NSLog(@"pushing to single");Single1ViewController*svc=[self.storyboard instantiateViewControllerWithIdentifier:@"SingleView"];svc.post_id=post_id;svc.page=998;

[self.navigationController pushViewController:svc animated:YES];

}

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容