 |
 |
|
 |
02-09-2010, 02:20 PM
|
#1 (permalink)
|
|
Banned
Join Date: Dec 2009
Posts: 61
|
dismissModalViewController not working
Hi everyone,
For some reason, my app crashes every time I try to dismiss a modal view controller. I have been through all my code and cannot find a reason for this (I even re-checked the Apple documentation to make sure that I wasn't missing anything), so I'll post it in the hope one of you may find the problem:
Code:
//IN MY MAIN VIEW CONTROLLER HEADER FILE
#import "GameOverViewController.h"
@interface JumpViewController : UIViewController <GameOverViewControllerDelegate>...
//IN MY MAIN VIEW CONTROLLER IMPLEMENTATION FILE
-(void)gameOverViewControllerDidFinish:(GameOverViewController *)viewController {
[self dismissModalViewControllerAnimated:YES];
}
//IN MY GameOverViewController HEADER FILE
@interface GameOverViewController : UIViewController {
id <GameOverViewControllerDelegate> delegate; }
@property (nonatomic, assign) id <GameOverViewControllerDelegate> delegate;
@end
@protocol GameOverViewControllerDelegate
-(void) gameOverViewControllerDidFinish:(GameOverViewController *)viewController;
@end
//IN MY GameOverViewController IMPLEMENTATION FILE
-(IBAction)dismiss {
[self.delegate gameOverViewControllerDidFinish:self];
}
I am sorry if the problem is something simple I have missed, but I have checked and re-checked it and can find nothing wrong :S
Thanks
Cam
|
|
|
02-09-2010, 02:56 PM
|
#2 (permalink)
|
|
Registered Member
Join Date: Jul 2009
Posts: 110
|
Quote:
Originally Posted by iPhoneDevelopment
Hi everyone,
For some reason, my app crashes every time I try to dismiss a modal view controller. I have been through all my code and cannot find a reason for this (I even re-checked the Apple documentation to make sure that I wasn't missing anything), so I'll post it in the hope one of you may find the problem:
Code:
//IN MY MAIN VIEW CONTROLLER HEADER FILE
#import "GameOverViewController.h"
@interface JumpViewController : UIViewController <GameOverViewControllerDelegate>...
//IN MY MAIN VIEW CONTROLLER IMPLEMENTATION FILE
-(void)gameOverViewControllerDidFinish:(GameOverViewController *)viewController {
[self dismissModalViewControllerAnimated:YES];
}
//IN MY GameOverViewController HEADER FILE
@interface GameOverViewController : UIViewController {
id <GameOverViewControllerDelegate> delegate; }
@property (nonatomic, assign) id <GameOverViewControllerDelegate> delegate;
@end
@protocol GameOverViewControllerDelegate
-(void) gameOverViewControllerDidFinish:(GameOverViewController *)viewController;
@end
//IN MY GameOverViewController IMPLEMENTATION FILE
-(IBAction)dismiss {
[self.delegate gameOverViewControllerDidFinish:self];
}
I am sorry if the problem is something simple I have missed, but I have checked and re-checked it and can find nothing wrong :S
Thanks
Cam
|
Hi,
in the View you want to dismiss:
Code:
- (IBAction)doneModalView {
[self.delegate modalViewControllerDidFinish:self];
}
and in the View you want to dive into:
Code:
-(void)modalViewControllerDidFinish:(ModalViewController *)controller {
[self dismissModalViewControllerAnimated:YES];
}
BR
Stefan
|
|
|
02-11-2010, 12:39 PM
|
#3 (permalink)
|
|
Banned
Join Date: Dec 2009
Posts: 61
|
That is exactly the code that I am already using... I just cannot figure out why it isn't working????
Cam
|
|
|
 |
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
» Advertisements |
» Online Users: 432 |
| 40 members and 392 guests |
| AdamSubach, aderrington, anubhab123, benoitr007, BrianSlick, caseysackett, Danneman, dev123, ErichGS, futurevilla216, Gambit, GreatWizard, gustavo7sexton, gw1921, HemiMG, HowEver, iSDK, Jeremy1026, joelhull, lifeCoder45, mattiahalter, mcapraro, melodizzzy, mriphoneman, newchucky, Ovidius, Piequanna, qilin, Racker, rendezvouscp, riq, Sega dude, socals, themathminister, timle8n1, tinrocket, Whitehk, ZunePod |
| Most users ever online was 965, 06-30-2010 at 04:26 AM. |
» Stats |
Members: 41,862
Threads: 49,770
Posts: 213,057
Top Poster: BrianSlick (3,139)
|
| Welcome to our newest member, futurevilla216 |
|