views:

62

answers:

2

Hello,

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

+2  A: 

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.

itaiferber
Hey Thanks, that was it, now I`m getting an other warning, but it might be unrelated :warning: 'AppDelegate' may not respond to '-presentModalViewController:animated:'
Julz
A: 

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;
}
Jinah Adam