views:

72

answers:

1

Hello,

I`m getting this annoying warning :

warning: 'AppDelegate' may not respond to '-presentModalViewController:animated:'

In this implementation file :

- (IBAction)showInfo:(id)sender {    

    FlipsideViewController *controller = [[FlipsideViewController alloc] initWithNibName:@"FlipsideView" bundle:nil];
    controller.delegate = self;

    controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
    [self presentModalViewController:controller animated:YES];

    [controller release];
}

at the line :

self presentModalViewController:controller animated:YES];

and here is the header file :

#import <UIKit/UIKit.h>
#import "FlipsideViewController.h"

@interface AppDelegate : NSObject <UIApplicationDelegate, UIScrollViewDelegate, FlipsideViewControllerDelegate> {
    UIWindow *window;
    UIScrollView *scrollView;
    UIPageControl *pageControl;
    NSMutableArray *viewControllers;
    UIView *flipside;
    UIImageView *infoButton;

    // To be used when scrolls originate from the UIPageControl
    BOOL pageControlUsed;
}

@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UIScrollView *scrollView;
@property (nonatomic, retain) IBOutlet UIPageControl *pageControl;
@property (nonatomic, retain) IBOutlet UIView *flipside;
@property (nonatomic, retain) IBOutlet UIImageView *infoButton;
@property (nonatomic, retain) NSMutableArray *viewControllers;

- (IBAction)showInfo:(id)sender;
- (IBAction)changePage:(id)sender;

@end

Obviously there is something I`m not getting, but I would appreciate if someone could help :)

+1  A: 

You must persent modal view controllers from an instance of UIViewController (not your application delegate). If you check out the documentation on UIViewController, you can access a sample application using the modal presentation.

Kevin Sylvestre
Ok that does make sense , I'll have to revise the code to call it from a UIViewController.Thanks for helping
Julz