2010-09-02 126 views
0

我在這裏做錯了什麼,但我不知道它是什麼。類委託沒有實現協議

AppDelegate.h

#import <UIKit/UIKit.h> 


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

    // 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) NSMutableArray *viewControllers; 

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

@end 

AppDelegate.m

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

這是我真的越來越: 警告:類 '的AppDelegate' 不落實「FlipsideViewControllerDelegate ' 協議。

後行: controller.delegate = self;

我FlipsideViewController.h看起來是這樣的:

#import <UIKit/UIKit.h> 

@protocol FlipsideViewControllerDelegate; 


@interface FlipsideViewController : UIViewController { 
    id <FlipsideViewControllerDelegate> delegate; 
} 

@property (nonatomic, assign) id <FlipsideViewControllerDelegate> delegate; 
- (IBAction)done:(id)sender; 
@end 


@protocol FlipsideViewControllerDelegate 
- (void)flipsideViewControllerDidFinish:(FlipsideViewController *)controller; 
@en 

任何幫助,將不勝感激:)

回答

4

這是錯誤信息說什麼。 AppDelegate只是沒有實現協議。在頭文件中,在括號之間加上FlipsideViewControllerDelegate(即<UIApplicationDelegate, UIScrollViewDelegate, FlipsideViewControllerDelegate>),並實現-flipsideViewControllerDidFinish:方法。

+0

嘿感謝,這是它,現在我真的得到一個其他的報警,但也可能是不相關的: 警告:「AppDelegate中」可能不響應「 -presentModalViewController:動畫:」 – 2010-09-02 04:13:45

0

嘗試加入FlipsideViewControllerDelegate到的appDelegate

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

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