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];

}

你可能感兴趣的:(dismissviewcontrolleranimated completion block 页面传值)