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

jgray106

macrumors newbie
Original poster
Ok, I'm making my very first iPhone application (so bear with me... and sorry if there is heaps of information/explanation before I get to the problem, but I just want to make sure that you get the whole story)

I am making a quiz application and, considering there is over 400 questions and menus and stuff like that... I have spent weeks creating png files with the questions and menus etc... Ok, so in xcode I have added .h and .m files for every screen that I have made. Firstly I would like to know if I have made any mistakes with the code (I've never written code before...)

This is the code that is in each .h file (note that I did not actually put "name" in place of my name and did not put "nextscreen" in there, I just put that as an example):


//
// name.h
// name
//
// Created by name on date.
// Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import <UIKit/UIKit.h>


@interface FilmViewController : UIViewController {

}

-(IBAction)nextscreen;
-(IBAction)nextscreen;

@end

This is the code that I have put in the .m files (same as above, I did not put in "name" and "nextscreen"):

//
// name.m
// name
//
// Created by name on date.
// Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import "nextscreenViewController.h"
#import "nextscreenViewController.h"


@implementation nextscreenViewController

- (IBAction)nextscreen;

{

nextscreenViewController *nextscreen = [[nextscreenViewController alloc] initWithNibName:nil bundle:nil];

[self presentModalViewController:nextscreen animated:NO];

}
- (IBAction)nextscreen;

{

nextscreenViewController *nextscreen = [[nextscreenViewController alloc] initWithNibName:nil bundle:nil];

[self presentModalViewController:nextscreen animated:NO];

}

**(after this, this is word for word what I have)**

/*
// The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
- (id)initWithNibName🙁NSString *)nibNameOrNil bundle🙁NSBundle *)nibBundleOrNil {
if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
// 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 {
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}


- (void)dealloc {
[super dealloc];
}


@end

Ok, so after I did that for all the screens, I created the .xib files from (User Interface --> Window XIB) and I named them all exactly the same thing as all the .h and .m files (for example if I named one DFE.h and DFE.m then I did DFE.xib)

I then tried to use Interface Builder to "link" the pages that I created. I double-clicked on the newly created xib files, placed in an image view, put in one of my png screens, then placed round rect buttons over the buttons that I need people to press to get to the next screen, changed the button type to custom, but now I can't see the "received actions" that I created in the .h and .m files. What am I doing wrong? Please help! 😕
 
Please consider changing the thread name to something more useful. That way you might get better answers.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.