Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 02-09-2010, 03:56 PM   #2 (permalink)
StefanL
Registered Member
 
Join Date: Jul 2009
Location: Wien/Austria
Posts: 242
Default

Quote:
Originally Posted by iPhoneDevelopment View Post
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
StefanL is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 158,864
Threads: 89,223
Posts: 380,688
Top Poster: BrianSlick (7,129)
Welcome to our newest member, elliotbrady
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 05:50 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.