ModalViewController within a UINavigationController not animating on dismissal

I've got an application with several modal view controllers. Most of them work fine except for one that is within a UINavigationController (so that I can show a navbar). When this modal view controller is displayed it animates fine but when dismissed it does not animate. I'd really like it to animate. Any thoughts?

Thanks much!

Here is the modal view controller (I've simplified the code, hopefully not too much!):

@protocol SettingsDelegate;

@interface Settings : UIViewController <UITextFieldDelegate> {
       id<SettingsDelegate> delegate;
}
@property (assign) id<SettingsDelegate> delegate;

@end

@protocol SettingsDelegate <NSObject>

@optional
- (void)Settings:(Settings *)controller dismissModalController:(NSString *)foo;

@end

The main routine .h looks like:

#import "Settings.h"

@interface MainPageController : UIViewController <SettingsDelegate> {
}
@end

The main routine .m looks like this:

- (void)Settings:(Settings *)controller dismissModalController:(NSString *)foo {
    [self dismissModalViewControllerAnimated:YES];
}

- (void)doSettings {
       Settings *addController = [[Settings alloc] initWithNibName:@"Settings" bundle:nil];
       addController.delegate = self;
       UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:addController];
       [self presentModalViewController:navigationController animated:YES];
}

Upvotes: 0

Views: 546

Answers (1)

Rudiger
Rudiger

Reputation: 6769

It all looks fine, my guess is you are releasing something before you are meant to and it is resulting in the view disappearing. Remove your release statements and see if it fixes the problem, then work backwards to see where it went wrong.

Upvotes: 3

Related Questions