views:

3371

answers:

4

I have a simple iphone app that's based on the CrashLanding sample app. So basically you tap the title screen and do some stuff... all on the same "view". I want to add an "options" screen/page/view whatever with a few UISwitches. What's the easiest way to do this?

Cheers!

A: 

Dunno if this will help I'm a bit new to objective-c and iPhone api.

Maybe u can do something like this: Use the interface builder: just type "Interface Builder" on the Spotlight (top right corner) to generate like "myOptions.xib"

And then just implement it: like

@implementation myOptions

-(void)awakeFromNib
{
...

You can take a look at the QuartzDemo under the iPhone API to see how to load the interface list of objects. In the previous view controller you just need to add it to the object list. It will look something like this:

@implementation previousController
-(void)awakeFromNib
{
    menuList = [[NSMutableArray alloc] init];
    QuartzViewController *controller;

    controller = [[QuartzViewController alloc] initWithTitle:@"Options"];
    controller.quartzViewDelegate = [[[myOptions alloc] init] autorelease];
    [menuList addObject:controller];
    [controller release];

Hope it helps

fmsf
It's not at all clear what this is trying to achieve. This breaks several Cocoa conventions, and doesn't seem to address the issue of displaying another view.
mmalc
A: 

Use the Interface Builder to open MainWindow.xib. Add a new View to the XIB. Refer to the Interface Builder User Guide for more details.

http://developer.apple.com/documentation/DeveloperTools/InterfaceBuilder-date.html#doclist

Parveen Kaler
You generally should not simply add views to the main window. New views should be managed by a separate view controller.
mmalc
+2  A: 

There are numerous examples that show how to manage multiple full-screen views -- each view should typically be managed by a separate view controller. Check the Xcode templates for an example of how you can set up a "flip" view.

mmalc
A: 

While everyone has mentioned ways and pointers for displaying an additional view, if you are trying to solve your original problem of displaying application settings, you may want to use a settings bundle instead as per the Apple HIG for the iPhone

http://developer.apple.com/iphone/library/documentation/UserExperience/Conceptual/MobileHIG/HandleTasks/chapter_6_section_4.html#//apple_ref/doc/uid/TP40006556-CH16-SW4

For how to do this, see this:

http://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/ApplicationSettings/chapter_12_section_1.html#//apple_ref/doc/uid/TP40007072-CH13-SW10

lfalin
Adjusting settings requires the the user exit the application! Not an ideal solution. From your first link:"Be aware that users must quit your application to adjust settings in the Settings application, so you should not provide settings that users need to set more than once."
Jason Moore