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

sdkIQ for iPhone
($4.99)

Your First iPhone App
($1.99)

iPhone Code Generator
($9.99)

Dual Matches
($0.99)

Calcuccino Programmers' Calculator
($2.99)

SDKtoday
(free)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 02-09-2010, 02:20 PM   #1 (permalink)
Banned
 
Join Date: Dec 2009
Posts: 61
Default 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
iPhoneDevelopment is offline   Reply With Quote
Old 02-09-2010, 02:56 PM   #2 (permalink)
Registered Member
 
Join Date: Jul 2009
Posts: 110
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
Old 02-11-2010, 12:39 PM   #3 (permalink)
Banned
 
Join Date: Dec 2009
Posts: 61
Default

That is exactly the code that I am already using... I just cannot figure out why it isn't working????

Cam
iPhoneDevelopment is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


» Advertisements
» Stats
Members: 41,862
Threads: 49,770
Posts: 213,057
Top Poster: BrianSlick (3,139)
Welcome to our newest member, futurevilla216
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 07:05 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0