доступ к неизвестному компоненту свойства flipDelegate - PullRequest
0 голосов
/ 06 апреля 2011

Привет, когда я компилирую свой код, я получаю эту ошибку - "доступ к неизвестному компоненту свойства flipDelegate"

это код, откуда я получаю ошибку-

//
//  RootViewController.m
//  Dolphia
//
//  Created by Dolphia Nandi on 4/3/11.
//  Copyright 2011 State University of New York at Buffalo. All rights reserved.
//


#import "RootViewController.h"
#import "MainViewController.h"
#import "FlipSideViewController.h"

@implementation RootViewController

@synthesize mainViewController;
@synthesize flipSideViewController;

- (void)loadMainViewController {
    MainViewController *viewController = [[MainViewController alloc] initWithNibName:@"MainViewController" bundle:nil];
    self.mainViewController = viewController;
    self.mainViewController.flipDelegate = self;
    [viewController release];
}

- (void)loadFlipSideViewController {
    FlipSideViewController *viewController = [[FlipSideViewController alloc] initWithNibName:@"FlipSideViewController" bundle:nil];
    self.flipSideViewController = viewController;
    self.flipSideViewController.flipDelegate = self;
    [viewController release];
}

- (void)viewDidLoad {
    [self loadMainViewController]; // Don't load the flipside view unless / until necessary
    [self.view addSubview:mainViewController.view];
}

// This method is called when either of the subviews send a delegate message to us.
// It flips the displayed view from the whoever sent the message to the other.
- (void)toggleView:(id)sender {
    if (flipSideViewController == nil) {
        [self loadFlipSideViewController];
    }

    UIView *mainWindow = mainViewController.view;
    UIView *flipSideView = flipSideViewController.view;
    /*[UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:1];
    if(flipeffect >= 0 && flipeffect < 2) {
        flipeffect++;
        [UIView setAnimationTransition:((voiceViewController == sender) ? UIViewAnimationTransitionFlipFromRight : UIViewAnimationTransitionFlipFromLeft) forView:self.view cache:YES];
    } else if (flipeffect >= 2 && flipeffect < 4) {
        flipeffect++;
        [UIView setAnimationTransition:((voiceViewController == sender) ? UIViewAnimationTransitionCurlUp : UIViewAnimationTransitionCurlDown) forView:self.view cache:YES];
    } else if (flipeffect >= 4 && flipeffect < 6) {
        flipeffect++;
        [UIView setAnimationTransition:((voiceViewController == sender) ? UIViewAnimationTransitionFlipFromLeft : UIViewAnimationTransitionFlipFromRight) forView:self.view cache:YES];
    } else {
        flipeffect++;
        if(flipeffect > 7)
            flipeffect = 0;
        [UIView setAnimationTransition:((voiceViewController == sender) ? UIViewAnimationTransitionCurlDown : UIViewAnimationTransitionCurlUp) forView:self.view cache:YES];
    }*/

    if (mainViewController == sender) {
        [flipSideViewController viewWillAppear:YES];
        [mainViewController viewWillDisappear:YES];
        [mainWindow removeFromSuperview];
        [self.view addSubview:flipSideView];
        [mainViewController viewDidDisappear:YES];
        [flipSideViewController viewDidAppear:YES];
    } else {
        [mainViewController viewWillAppear:YES];
        [flipSideViewController viewWillDisappear:YES];
        [flipSideView removeFromSuperview];
        [self.view addSubview:mainWindow];
        [flipSideViewController viewDidDisappear:YES];
        [mainViewController viewDidAppear:YES];
    }
    //[UIView commitAnimations];
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview
    // Release anything that's not essential, such as cached data
}

- (void)dealloc {
    [mainViewController release];
    [flipSideViewController release];
    [super dealloc];
}

@end

1 Ответ

0 голосов
/ 06 апреля 2011

Обе mainViewController и flipSideViewController должны иметь flipDelegate в качестве переменной экземпляра и убедитесь, что вы добавили @synthesize и @property

...