Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

codermon

macrumors newbie
Original poster
Nov 27, 2012
1
0
thanks for taking the time to read my problem and help me:)

I am building a TabView project and on tab 3 of the app I have a row of albums, in album 3, page 1 the nextButton takes the user to page 2 of the album. Page 2 has more buttons, including a backPage(get back to page 1) and a backButton(to go back to the album selection page).

ERROR:

Code:
    A3Page2ViewController.m:92:49: Property 'view' cannot be found in forward class object 'A3Page1ViewController'

WARNING:

Code:
    A3Page2ViewController.m:91:28: Receiver 'A3Page1ViewController' is a forward class and corresponding @interface may not exist
I have searched this site and others and most of the answers are in relation to how @Class should be used in the header filw and #import ".h" should only be used in the .m file. I have checked my code and I was following the rules, so why does it still not work?

THIS IS WHAT I HAVE DONE: This is the function(in A3Page2ViewController) that is apparently making the error...

Code:
    -(IBAction)backPage:(id)sender
    {
    	a3Page1ViewController = [[A3Page1ViewController alloc]initWithNibName:@"A3Page1ViewController"bundle:nil];
        [self.view addSubview:a3Page1ViewController.view];
        
    }
**Please note that when commented out, the app runs FINE all the views are loaded, all buttons including backButton work. When uncommented it just refuses to build, with the errors.**


Below I list both A3Page1ViewController and A3Page2ViewController both the .h and .m files.

You can see that I have the @class and #import ".h" in the correct places.

WEIRDNESS!!
I actually have the exact same code WORKING in the 2nd tab, I use it to switch between views with out any problem. SO WHY DOES IT NOT WORK HERE?!?!

**PLEASE HELP I AM STUCK ATM AND I DON'T KNOW WHY:/**

A3Page1ViewController.h

Code:
    #import <UIKit/UIKit.h>
    
    @class A3Page2ViewController;
    @class ThirdViewController;
    @class A3P1;
    @class A3P2;
    @class A3P3;

    
    @interface A3Page1ViewController : UIViewController  {
    
    	A3Page2ViewController*a3Page2ViewController;
    	ThirdViewController*thirdViewController;
    	
    	A3P1*A3P1;
    	A3P2*A3P2;
    	A3P3*A3P3;

    
        UIButton *button1;
        UIButton *button2;
        UIButton *button3;

    	UIButton *nextButton;
    	UIButton *backButton;
    }
    
    @property(nonatomic,retain) IBOutlet A3Page2ViewController *a3Page2ViewController;
    @property(nonatomic,retain) IBOutlet ThirdViewController *thirdViewController;
    @property(nonatomic,retain) IBOutlet A3P1 *a3P1;
    @property(nonatomic,retain) IBOutlet A3P2 *a3P2;
    @property(nonatomic,retain) IBOutlet A3P3 *a3P3;

    
    @property (nonatomic, retain) IBOutlet UILabel *logoLabel;
    @property (nonatomic, retain) IBOutlet UILabel *descriptionLabel;
    @property (nonatomic, retain) IBOutlet UILabel *copyrightLabel;
    
    
    @property(nonatomic,retain) IBOutlet UIButton *button1;
    @property(nonatomic,retain) IBOutlet UIButton *button2;
    @property(nonatomic,retain) IBOutlet UIButton *button3;

    @property(nonatomic,retain) IBOutlet UIButton *nextButton;
    @property(nonatomic,retain) IBOutlet UIButton *backButton;
    
    -(IBAction)FirstButton:(id)sender;
    -(IBAction)SecondButton:(id)sender;
    -(IBAction)ThirdButton:(id)sender;

    -(IBAction)nextPage:(id)sender;
    -(IBAction)backButton:(id)sender;
    
    
    @end
A3Page1ViewController.m

Code:
    #import "A3Page1ViewController.h"
    #import "FXLabel.h"
    #import <QuartzCore/QuartzCore.h>
    #import "A3Page2ViewController.h"
    #import "ThirdViewController.h"
    #import "A3P1.h"
    #import "A3P2.h"
    #import "A3P3.h"
    
    
    
    @implementation A3Page1ViewController
    
    @synthesize  a3Page2ViewController,thirdViewController,a3P1 ,a3P2 ,a3P3 , logoLabel, descriptionLabel, button1,button2,button3,nextButton,backButton, copyrightLabel;
    
    
    -(UILabel*)createLabelWithFrame:(CGRect)frame andFontSize:(float)fontSize andText:(NSString*)text
    {
        UILabel* label = [[UILabel alloc] initWithFrame:frame];
        [label setFont:[UIFont systemFontOfSize:fontSize]];
        [label setTextColor:[UIColor whiteColor]];
        [label setShadowColor:[UIColor blackColor]];
        [label setShadowOffset:CGSizeMake(0, -1)];
        //[label setTextAlignment:UITextAlignmentCenter];
        [label setBackgroundColor:[UIColor clearColor]];
        [label setText:text];
        return label;
    }
    
    -(IBAction)FirstButton:(id)sender
    {
    	a3P1 = [[A3P1 alloc]initWithNibName:@"A3P1"bundle:nil];  
        [self.view addSubview:a3P1.view];
    }
    
    -(IBAction)SecondButton:(id)sender
    {
    	
    	a3P2 = [[A3P2 alloc]initWithNibName:@"A3P2"bundle:nil];  
        [self.view addSubview:a3P2.view];
    
    }
    
    -(IBAction)ThirdButton:(id)sender
    {
    	a3P3 = [[A3P3 alloc]initWithNibName:@"A3P3"bundle:nil];  
        [self.view addSubview:a3P3.view];	
    	
    }
    
    -(IBAction)backButton:(id)sender
    {
    	thirdViewController = [[ThirdViewController alloc]initWithNibName:@"ThirdView"bundle:nil];  
    	[self.view addSubview:thirdViewController.view];
    }
    -(IBAction)nextPage:(id)sender
    {
    	a3Page2ViewController = [[A3Page2ViewController alloc]initWithNibName:@"A3Page2ViewController"bundle:nil];  
    	[self.view addSubview:a3Page2ViewController.view];
    }
    
    
    - (void)viewDidLoad  
    {
    	//CGRectMake(x,y,width,height);
    	
    	// Do any additional setup after loading the view, typically from a nib.
    }
    
    
    
    
    
    /*
     // The designated initializer. Override to perform setup that is required before the view is loaded.
     - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
     self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
     if (self) {
     // Custom initialization
     }
     return self;
     }
     */
    
    /*
     // Implement loadView to create a view hierarchy programmatically, without using a nib.
     - (void)loadView {
     }
     */
    
    /*
     // Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
     - (void)viewDidLoad {
     [super viewDidLoad];
     }
     */
    
    /*
     // Override to allow orientations other than the default portrait orientation.
     - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
     // Return YES for supported orientations
     return (interfaceOrientation == UIInterfaceOrientationPortrait);
     }
     */
    
    
    - (void)didReceiveMemoryWarning {
    	// Releases the view if it doesn't have a superview.
        [super didReceiveMemoryWarning];
    	
    	// Release any cached data, images, etc that aren't in use.
    }
    
    - (void)viewDidUnload {
    	// Release any retained subviews of the main view.
    	// e.g. self.myOutlet = nil;
    }
    
    
    - (void)dealloc {
        [super dealloc];
    }
    
    @end

A3Page2ViewController.h

Code:
    @class A3Page1ViewController;
    @class ThirdViewController;
    @class A3P10;
    @class A3P11;
    @class A3P12;
    
    
    
    @interface A3Page2ViewController : UIViewController  {
    	
    	A3Page1ViewController*a3Page1ViewController;
    	ThirdViewController*thirdViewController;
    	A3P10*a3P10;
    	A3P11*a3P11;
    	A3P12*a3P12;
    
    	
        UIButton *button1;
        UIButton *button2;
        UIButton *button3;

    	UIButton *backButton;
    	UIButton *backPage;
    	
    }
    
    @property(nonatomic,retain) IBOutlet A3Page1ViewController *a3Page1ViewController;
    @property(nonatomic,retain) IBOutlet ThirdViewController *thirdViewController;
    
    @property(nonatomic,retain) IBOutlet A3P10 *a3P10;
    @property(nonatomic,retain) IBOutlet A3P11 *a3P11;
    @property(nonatomic,retain) IBOutlet A3P12 *a3P12;
    
    
    @property(nonatomic,retain) IBOutlet UIButton *button1;
    @property(nonatomic,retain) IBOutlet UIButton *button2;
    @property(nonatomic,retain) IBOutlet UIButton *button3;

    @property(nonatomic,retain) IBOutlet UIButton *backButton;
    @property(nonatomic,retain) IBOutlet UIButton *backPage;
    
    -(IBAction)FirstButton:(id)sender;
    -(IBAction)SecondButton:(id)sender;
    -(IBAction)ThirdButton:(id)sender;

    -(IBAction)backButton:(id)sender;
    -(IBAction)backPage:(id)sender;
    
    @end
A3Page2ViewController.m

Code:
    #import "A3Page1ViewController.h"
    #import "FXLabel.h"
    #import <QuartzCore/QuartzCore.h>
    #import "A3Page2ViewController.h"
    #import "ThirdViewController.h"
    #import "A3P10.h"
    #import "A3P11.h"
    #import "A3P12.h"
    
    
    @implementation A3Page2ViewController
    
    @synthesize  thirdViewController,a3Page1ViewController,a3P10 ,a3P11 ,a3P12, backButton,backPage, button1,button2,button3,button4,button5,button6,button7,button8,button9;
    
    
    -(UILabel*)createLabelWithFrame:(CGRect)frame andFontSize:(float)fontSize andText:(NSString*)text
    {
        UILabel* label = [[UILabel alloc] initWithFrame:frame];
        [label setFont:[UIFont systemFontOfSize:fontSize]];
        [label setTextColor:[UIColor whiteColor]];
        [label setShadowColor:[UIColor blackColor]];
        [label setShadowOffset:CGSizeMake(0, -1)];
        //  [label setTextAlignment:UITextAlignmentCenter];
        [label setBackgroundColor:[UIColor clearColor]];
        [label setText:text];
        return label;
    }
    
    -(IBAction)FirstButton:(id)sender
    {
    	a3P10 = [[A3P10 alloc]initWithNibName:@"A3P10"bundle:nil];
        [self.view addSubview:a3P10.view];
    }
    
    -(IBAction)SecondButton:(id)sender
    {
    	
    	a3P11 = [[A3P11 alloc]initWithNibName:@"A3P11"bundle:nil];
        [self.view addSubview:a3P11.view];
    	
    }
    
    -(IBAction)ThirdButton:(id)sender
    {
    	a3P12 = [[A3P12 alloc]initWithNibName:@"A3P12"bundle:nil];
        [self.view addSubview:a3P12.view];
    	
    }

    
    -(IBAction)backButton:(id)sender
    {
    	thirdViewController = [[ThirdViewController alloc]initWithNibName:@"ThirdView"bundle:nil];
        [self.view addSubview:thirdViewController.view];
    	
    }
    -(IBAction)backPage:(id)sender
    {
    //*****Alleged Error/Warning causing code=[********
    	a3Page1ViewController = [[A3Page1ViewController alloc]initWithNibName:@"A3Page1ViewController"bundle:nil];
        [self.view addSubview:a3Page1ViewController.view];
        
    }
    
    
    - (void)viewDidLoad
    {
    	//CGRectMake(x,y,width,height);
    	
    	
    	// Do any additional setup after loading the view, typically from a nib.
    }
    
 
    /*
     // The designated initializer. Override to perform setup that is required before the view is loaded.
     - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
     self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
     if (self) {
     // Custom initialization
     }
     return self;
     }
     */
    
    /*
     // Implement loadView to create a view hierarchy programmatically, without using a nib.
     - (void)loadView {
     }
     */
    
    /*
     // Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
     - (void)viewDidLoad {
     [super viewDidLoad];
     }
     */
    
    /*
     // Override to allow orientations other than the default portrait orientation.
     - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
     // Return YES for supported orientations
     return (interfaceOrientation == UIInterfaceOrientationPortrait);
     }
     */
    
    
    - (void)didReceiveMemoryWarning {
    	// Releases the view if it doesn't have a superview.
        [super didReceiveMemoryWarning];
    	
    	// Release any cached data, images, etc that aren't in use.
    }
    
    - (void)viewDidUnload {
    	// Release any retained subviews of the main view.
    	// e.g. self.myOutlet = nil;
    }
    
    
    - (void)dealloc {
        [super dealloc];
    }
    
    @end
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.