Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 12-07-2009, 11:19 AM   #1 (permalink)
MMS
Registered Member
 
Join Date: Nov 2009
Location: Connecticut
Posts: 95
Default How to connect/activate a bar button item.

Hello,

I have programmaticly added a rightBarButton item to some levels of my drill-down navigation based application, but I am not sure how/ what code I need to use to get the button to switch Views. Here is what I've done so far:

As follows: (in viewDidLoad)

UIBarButtonItem *NextButton = [[[UIBarButtonItem alloc] initWithTitle:@"Next" style:UIBarButtonItemStylePlain target:self action:@selector (Next)] autorelease];
self.navigationItem.rightBarButtonItem = NextButton;

And Specified an IBAction to switch the view and load another view:

- (IBAction)switchviewid)sender
{
BottegonViewController *Bottegon = [[BottegonViewController alloc] initWithNibName:nil bundle:nil];
Bottegon.modalTransitionStyle= UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:Bottegon animated:YES];
}

Can anyone tell me how to relate the button to switching the view so that when the button is pressed it will load the next view?
MMS is offline   Reply With Quote
Old 12-07-2009, 11:30 AM   #2 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,129
Default

Do a little more reading about the action parameter.
__________________
BriTer Ideas LLC - Code review, consulting, development. PM for pricing.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
BrianSlick is offline   Reply With Quote
Old 12-07-2009, 11:39 AM   #3 (permalink)
MMS
Registered Member
 
Join Date: Nov 2009
Location: Connecticut
Posts: 95
Default

Quote:
Originally Posted by BrianSlick View Post
Do a little more reading about the action parameter.
Thanks for writing. I had assume that the action parameter was part of my issue. But I know it's not as simple as action:switchview

Can you recommend specific sources for reading?
MMS is offline   Reply With Quote
Old 12-07-2009, 11:41 AM   #4 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,129
Default

Documentation... examples of making buttons do things....

Code:
action:@selector(switchview:)
__________________
BriTer Ideas LLC - Code review, consulting, development. PM for pricing.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
BrianSlick is offline   Reply With Quote
Old 12-07-2009, 11:46 AM   #5 (permalink)
MMS
Registered Member
 
Join Date: Nov 2009
Location: Connecticut
Posts: 95
Default

Quote:
Originally Posted by BrianSlick View Post
Documentation... examples of making buttons do things....

Code:
action:@selector(switchview:)
And to think...at first I didn't like you!

Thank you very much!!
MMS is offline   Reply With Quote
Reply

Bookmarks

Tags
barbuttonitem, button, switching views, view, view controller

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 260
17 members and 243 guests
ADY, Alsahir, dacapo, Dani77, Desert Diva, djohnson, F_Bryant, Grinarn, HemiMG, jansan, linkmx, M@realobjects, macquitzon216, prchn4christ, smethorst, spiderguy84
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,882
Threads: 89,228
Posts: 380,762
Top Poster: BrianSlick (7,129)
Welcome to our newest member, jansan
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 01:49 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0