After pressing on a button in a custom tableview cell I perform an asynch operation and in the selector callback call:
[self performSegueWithIdentifier:SEGUE_PURCHASE_SEGUE sender:self];
So the next callback is called:
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
}
and I can see in log that the new screen’s viewDidLoad and viewWillAppear methods already were called but the next screen will be shown only in several seconds after this.
What problem can be here?
CODE:
-(void) moveToPurchaseScreen{
NSLog(@"view1 moveToPurchaseScreen");
[self performSegueWithIdentifier:SEGUE_PURCHASE_SEGUE sender:self];
}
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
NSLog(@"view1 prepareForSegue");
//
// BSPurchaseViewController *purchaseViewController = [segue destinationViewController];
// purchaseViewController.pngImage = [BSSharedObject getInstance].createdImage;
//// [[BSPopupManager getInstance]closeWaitingPopup];
//
//
// NSLog(@"2");
}
-(void)viewDidDisappear:(BOOL)animated{
NSLog(@"view1 DidDisappear");
}
2012-10-10 21:51:15.644 BarneyShop[4961:11603] view1 moveToPurchaseScreen
2012-10-10 21:51:15.646 BarneyShop[4961:11603] view1 prepareForSegue
2012-10-10 21:51:15.647 BarneyShop[4961:11603] view2 viewDidLoad
2012-10-10 21:51:15.648 BarneyShop[4961:11603] view2 viewWillAppear
2012-10-10 21:51:23.812 BarneyShop[4961:f803] view1 DidDisappear
EDIT 2:
[purchase initPurchase: self withSelector:@selector(moveToPurchaseScreen)andProduct:product];
-(void) initPurchase:(id)object withSelector:(SEL)selector andProduct:(Product *)product{
[operationQueue cancelAllOperations];
NSInvocationOperation *downloadImageOperation = [[NSInvocationOperation alloc] initWithTarget:[BSImageDownloader getInstance] selector:@selector(downloadImageSync:) object:URL_DOWNLOAD_IMAGE];
NSInvocationOperation *createImageOperation = [[NSInvocationOperation alloc] initWithTarget:[BSImageCreator getInstance] selector:@selector(createImage:) object:product];
NSInvocationOperation *saveImageOperation = [[NSInvocationOperation alloc] initWithTarget:[BSImageSaver getInstance] selector:@selector(saveImageAsPng:) object:nil];
NSInvocationOperation *callbackOperation = [[NSInvocationOperation alloc] initWithTarget:object selector:selector object:nil];
[createImageOperation addDependency:downloadImageOperation];
[saveImageOperation addDependency:createImageOperation];
[callbackOperation addDependency:saveImageOperation];
[operationQueue addOperation:downloadImageOperation];
[operationQueue addOperation:createImageOperation];
[operationQueue addOperation:saveImageOperation];
[operationQueue addOperation:callbackOperation];
}
In your method:
Let me know if this speeds up your process. I also noticed that this method gets called from a different thread. Are you calling it manually?
EDIT
Try this as well: