嗯,得到:可能无法响应'-presentModalViewController:animated:'

时间:2010-09-02 05:09:55

标签: iphone objective-c

我收到了这个恼人的警告:

警告:'AppDelegate'可能无法响应'-presentModalViewController:animated:'

在此实施文件中:

- (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];
}

在这一行:

self presentModalViewController:控制器动画:是];

这是头文件:

#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

显然有些东西我没有得到,但如果有人可以提供帮助我会很感激:)

1 个答案:

答案 0 :(得分:1)

您必须从UIViewController的实例(而不是您的应用程序委托)中获取模态视图控制器。如果您在UIViewController上查看documentation,则可以使用模式演示文稿访问示例应用程序。