Paul,

I don't understand enough about IB and Nibs  to help with how you are
plugging the view controls together.  I learned more by skipping IB at
the start and I'm just starting to figure it out.

The example below creates two views each with a button pointing to
this method:

- (void)nextView:(id)sender {

        [window exchangeSubviewAtIndex:0 withSubviewAtIndex:1];
}



If you use IB you'll need to create the methods as an IBaction.  Also,
look at the UIView doc for more info on managing views.  If you have
more than two views to control, I think the .tag property will help
you sort through things.

Hope it helps.

John

EAMPLE:

        //create an new view make it as big as the screen
        UIView *newView=[[[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0,
320.0, 500.0)] autorelease];

        //make it blue
        newView.backgroundColor=[UIColor blueColor];


        //make a button
        UIButton *newButton= [UIButton
buttonWithType:UIButtonTypeRoundedRect];

        newButton.frame=CGRectMake(10.0, 200.0, 300.0, 50.0);
        [newButton setTitle:@"TOUCH ME" forState:UIControlStateNormal];

        //give it something to do  THIS IS WHERE THE nextView METHOD GETS
CALLED
        [newButton addTarget:self action:@selector(nextView:)
forControlEvents:UIControlEventTouchUpInside];

        //add it to the view
        [newView addSubview:newButton];

        //add the view with the label to the window (which is just a subclass
of view)
        [window addSubview:newView];


        //make a new view
        UIView *newerView=[[[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0,
320.0, 500.0)] autorelease];
        newerView.backgroundColor=[UIColor purpleColor];

        //make a new button and add it
        UIButton *newerButton=[UIButton
buttonWithType:UIButtonTypeRoundedRect];
        newerButton.frame=CGRectMake(10.0, 100.0, 300.0, 50.0);
        [newerButton setTitle:@"TOUCH ME" forState:UIControlStateNormal];
        [newerButton addTarget:self action:@selector(nextView:)
forControlEvents:UIControlEventTouchUpInside];

        [newerView addSubview:newerButton];


        //add it to the window
        [window addSubview:newerView];

        [window makeKeyAndVisible];

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"iPhoneWebDev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/iphonewebdev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to