Reputation: 2209
I am having the below block in ViewController A
dispatch_async(dispatch_get_main_queue(), ^{
[self dismissAnimated:YES completion:^(BOOL finished) {
[[NSNotificationCenter defaultCenter] postNotificationName:@"adjustNavBar"
object:self];
}];
});
After the execution of 'dismissAnimated' block method the NSNotificationCenter is getting called and the Observer in ViewController B is executing the below code
- (void)viewDidLoad {
[super viewDidLoad];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(adjustNavBar)
name:@"adjustNavBar"
object:nil];
}
-(void)adjustNavBar {
[self checkForPartialScroll];
}
after execution of the above code, it is ending in ViewController A.
But i want to end the process in ViewController B. How to do this, i am newly trying this callback functions.
using Delegates or Callbacks, can i achieve what i am trying ?
Upvotes: 0
Views: 119
Reputation: 1693
try post notification
before dismissviewcontroller
:
[[NSNotificationCenter defaultCenter] postNotificationName:@"adjustNavBar" object:self];
dispatch_async(dispatch_get_main_queue(), ^{
[self dismissAnimated:YES completion:^(BOOL finished) {
}];
});
if not work , try run checkForPartialScroll
in mainthread
Upvotes: 1
Reputation:
write that code above your code , HomeVC name of your next VC & @"HomeVC" identifier of your next VC
dispatch_async(dispatch_get_global_queue(0, 0), ^{
HomeVC *homeVC = (HomeVC *) [self.storyboard instantiateViewControllerWithIdentifier:@"HomeVC"];
}
Upvotes: 0