Im trying to implement a modal view but get a number of errors. This is what Ive done so far, and Ive displayed the errors generated in red below the code it referes to:
1) Created a .xib-file (IntroScreen.xib) using the Interface Builder. Placed one button in it - does nothing, just for show.
2) In the IB, all Ive done is to write the class-files, producing IntroScreenController.h and .m:
IntroScreenController.h
IntroScreenController.m
3) In the rest of the project (another viewController) I first import the "IntroScreenController.h".
anotherViewController.m
4) Then I try to instantiate a introScreenController, and then use the presentModalViewController to display it on top:
anotherViewController.m -> viewDidAppear()
Any ideas?
1) Created a .xib-file (IntroScreen.xib) using the Interface Builder. Placed one button in it - does nothing, just for show.
2) In the IB, all Ive done is to write the class-files, producing IntroScreenController.h and .m:
IntroScreenController.h
Code:
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
@interface UIViewController : NSObject {
IBOutlet UINavigationItem *navigationItem;
IBOutlet UITabBarItem *tabBarItem;
IBOutlet UIView *view;
//
IBOutlet UIViewController *introScreenController;
}
//
@property (nonatomic, retain) UIViewController *introScreenController;
@end
IntroScreenController.m
Code:
#import "IntroScreenController.h"
[COLOR="#ff0000"]// ERROR: redefinition of 'struct UIViewController'[/COLOR]
@implementation UIViewController
// Synt: (various)
@synthesize introScreenController;
[COLOR="Red"]// ERROR: no declaration of property 'introScreenController' found in the interface.[/COLOR]
@end
3) In the rest of the project (another viewController) I first import the "IntroScreenController.h".
anotherViewController.m
Code:
// Import
#import "IntroScreenController.h
[COLOR="#ff0000"]// ERROR: redefinition of 'struct UIViewController'[/COLOR]
4) Then I try to instantiate a introScreenController, and then use the presentModalViewController to display it on top:
anotherViewController.m -> viewDidAppear()
Code:
// Instantiate viewcontroller
introScreenController *introScreen = [[introScreenController alloc] initWithNibName:@"IntroScreen" bundle:nil];
[COLOR="#ff0000"]// ERROR: 'introScreenController' undeclared (first use in this function)
// ERROR: 'introScreen' undeclared (first use in this function)[/COLOR]
// Present modal view
[self presentModalViewController:introScreen animated:YES];
Any ideas?