2

I am creating a program that will run an experiment on a user. It has a 'start' page with a button. When they click the button, I want the window to change to the 'test' page. I believe this is done by switching views, and I have tried to find some tutorials/answered questions on it by I have had trouble due to a few things:

-I'm not sure how to create the views themselves in Interface Builder

-I am NOT developing for the iPhone

Do I need to create a new XIB file? Should I have made multiple windows instead? Any help or direction in this matter would be very much appreciated! :D

2
  • do you have 2 view controller or only one?and do you want navigtion bar appi? Commented May 31, 2011 at 6:47
  • 1
    Ah, I don't know how the view controllers work either. >_< Apologies, I am new to Objective-C. So I currently don't have any. Why would someone need two view controllers? And I don't want a navigation bar (I think) Commented May 31, 2011 at 6:52

3 Answers 3

3

Let me strongly suggest that you forget about your particular task for a little while and instead spend some time learning how the Cocoa framework works. A good place to start might be the Cocoa Application Tutorial, which will walk you through the creation of a small MacOS X application (and quite possibly answer your question in the process). It's fine that you're new to Objective-C, Cocoa, etc., but in that case you should spend some time with Apple's documentation to help you get up to speed.

Sign up to request clarification or add additional context in comments.

Comments

1

I would suggest you to have a look at one of the many tutorials around there:

Learn Cocoa Tutorial: this one will guide you step by step through IB;

A full Cocoa/Xcode/Interface Builder Tutorial: this will deal more in detail with IB/Xcode integration.

Apple Tutorial: this is more in-depth and explains many more details and concepts, so good for a second read.

Or you might reach out for some good book, like the classic Cocoa Programming for Mac OS X By Aaron Hillegass

As a further suggestion, since you specify that you are NOT programming for the iphone, there are a lot of docs on the web. Main thing to find them out is use the keyword "cocoa" when searching for them.

Comments

0

I rather suggest to use view controllers, every view controller should have xib file you can simply handle actions like on button click etc...

I suggest to try out create window based app, so one view controller is already created, now click file add file and choose view controller.

in first xib you could add buttons and every component you like...then set the second one. you could create function

-(IBAction)foooFunction{
SecondViewController *foo = [[SecondViewController alloc] initWithNibName:nil bundle:nil];
[self presentModalViewController: foo
                            animated: YES];
    [foo release];
}

then in xib of your first view controller you just simply drag and drop the foooFunction onto the button and you have it.

Apologies, I am new to Objective-C

And it is not problem that you are new :) have a nice day and hope it helps

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.