How to make sure an action completes before you continue
- by HurkNburkS
I am trying to close a UIView thats in one method from another method by calling it, The UIView closes fine but not untill after all of the processes are finished in the current method.
I would like to know if there is a way to force the first thing to happen first (i.e. close UIviews) then continue the current method?
This is what my method looks like
- (void)selectDeselectAllPressed:(UIButton*)button {
int id = button.tag;
[SVProgressHUD showWithStatus:@"Updating" maskType:SVProgressHUDMaskTypeGradient];
[self displaySelected]; // removes current view so you can load hud will not be behind it
if (id == 1) {
[self selectAllD];
} else if (id == 2) {
[self deselectAllD];
} else if (id == 3) {
[self selectAllI];
} else if (id == 4) {
[self deselectAllI];
}
}
as you can see what happens is this method is called when a button is pressed, I would like for the displaySelected method to do what it needs to do before any of the other methods are called?
Currently what happes when i debug this is displaySelected method is called the thread walks through that then continues to the if statment then after the method in the if statment has finished then displaySelected changes are made... its so weird.
any help would be greatly appreciated.