Jump to content
1 post in this topic

Recommended Posts

I am web programmer, trying to get into the iPhone development. I have been through hundreds of tutorials and bought 3 books on the subject.

 

I am having problems with creating Views. I want to do a least 5 views, but I am stuck on one. I can't get past it. I always get an Uncaught Error Exception when I click a button to go to the next view.

 

I have 5 xib's set up each with their own view controllers and I have the RootViewController setup to switch out the current view for the next upon a button press. For simplicity sake I am posting just the RootViewController.h and .m here. Maybe someone with a greater deal and experience could show me what i am doing wrong.

 

The first view "Terms of Service" loads just fine. But when I click the "I accept button" on the TOS view it throws the error. It should switch to the MainMenu View. At least that's what I am trying to accomplish. Then on that view there is a button that will switch it to a username view etc... and so on.. I am just playing around with views.

 

 

If you need additional information please ask. I have worked on this for about 4 days troubleshooting it, most of the tutorials don't really help/explain very well.

 

RootViewController.h

#import 

@class	TofSViewController;
@class	MainMenuViewController;

@interface RootViewController : UIViewController {
TofSViewController* tosvc;
MainMenuViewController* mmvc;

}
@property (nonatomic, retain) TofSViewController * tosvc;
@property (nonatomic, retain) MainMenuViewController* mmvc;
-(void)acceptTOS;
@end

RootViewController.m

#import 
#import "RootViewController.h"
#import "TofSViewController.h"
#import	"MainMenuViewController.h"

@implementation RootViewController

#define kAnimationKey			@"MyAnimationKey"
#define kAnimationDuration		.5

@synthesize tosvc, mmpvc;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
	// Initialization code
}
return self;
}

-(void)acceptTOS{
[self.tosvc removeFromSuperview];	// Remove the splash view
[tosvc release];						// Release the splash view
tosvc = nil;

MainMenuViewController *aController = [[MainMenuViewController alloc] initWithNibName:@"MainMenu" bundle:nil];
self.mmvc = aController;
[aController release];
[self.view addSubview:mmvc.view];	

CATransition *animation = [CATransition animation];
[animation setType:kCATransitionPush];
[animation setSubtype:kCATransitionFromRight];
[animation setDuration:kAnimationDuration];
[[self.view layer] addAnimation:animation forKey:kAnimationKey];
}

@end

Link to comment
https://www.insanelymac.com/forum/topic/143108-more-than-2-views/
Share on other sites

×
×
  • Create New...