开发者

Hmm, getting : may not respond to '-presentModalViewController:animated:'

开发者 https://www.devze.com 2023-01-13 22:18 出处:网络
I`m getting this annoying warning : warning: \'AppDelegate\' may not respond to \'-presentModalViewController:animated:\'

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 :)


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消