开发者

Class Delegate does not implement protocol

I`m doing something wrong here but I can't figure out what it is .

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

This is whe开发者_运维百科re I`m getting : warning: class 'AppDelegate' does not implement the 'FlipsideViewControllerDelegate' protocol.

After line : controller.delegate = self;

My FlipsideViewController.h looks like this :

#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

Any help would be greatly appreciated :)


It's exactly what the error message says. AppDelegate just doesn't implement the protocol. In your header file, add FlipsideViewControllerDelegate between the brackets (i.e. <UIApplicationDelegate, UIScrollViewDelegate, FlipsideViewControllerDelegate>), and implement the -flipsideViewControllerDidFinish: method.


try adding FlipsideViewControllerDelegate to the 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;
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜