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 03-08-2010, 04:58 PM   #1 (permalink)
Registered Member
 
Join Date: Jul 2009
Location: Wien/Austria
Posts: 242
Default UINavigationBar "Next" Button

Hi Folks,

In my Application I am moving between two Views using the following code (inside my "didselectedRow"):

Code:
	ShowViewController *controller = [[ShowViewController alloc] initWithNibName:@"ShowViewController" bundle:[NSBundle mainBundle]];
	
	userName = [NSString stringWithFormat:@"%@ %@", takeLastName, takeFirstName];
	controller.userName = userName;
	controller.takeId = takeId;
	
    controller.delegate = self;
	//controller.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
	
	[self.navigationController pushViewController:controller animated:YES];
	
// [self presentModalViewController:controller animated:YES];
 
    [controller release];
    controller = nil;
This is working fine - the view will be switched and on the new View there is a "Back Button" which I have named using the following code:

Code:
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStylePlain target:nil action:nil];
	self.navigationItem.backBarButtonItem = backButton;
	[backButton release];
What can I do if I want not only a "Back - Button" but also a "Next Button"? How can I achieve this if I want to switch to a "ShowMoreController"?

Thanks for your feedback,

Stefan
StefanL is offline   Reply With Quote
Old 03-09-2010, 03:24 AM   #2 (permalink)
Registered Member
 
Join Date: Jan 2010
Location: Northern Ireland
Posts: 54
Default

So when they navigate from the selectRowAtIndex you want that view to have a next button?

You could add a barButtonItem to the navigation bar in the viewDidLoad method of that view and carry out the method you want in the action for the button. Although im not too sure if you can get a bar button item to have similar shape as the back button except with a forward point if you know what i mean.
johnblack45 is offline   Reply With Quote
Old 03-09-2010, 08:46 AM   #3 (permalink)
Registered Member
 
Join Date: Jul 2009
Location: Wien/Austria
Posts: 242
Default

Hi John,

thanks for your Feedback! I have solved it like this:

In viewDidAppear:

Code:
self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithTitle:@"More" style:UIBarButtonItemStylePlain target:self 
																			 action:@selector(moreButtonPressed:)] autorelease];
and then calling:

Code:
-(void)moreButtonPressed:(id)sender {
	
	NSLog(@"pressed");
	
	
	ShowMoreController *controller = [[ShowMoreController alloc] initWithNibName:@"ShowMoreController" bundle:[NSBundle mainBundle]];
	
	/*userName = [NSString stringWithFormat:@"%@ %@", takeLastName, takeFirstName];
	controller.userName = userName;
	controller.takeId = takeId;*/
	
    controller.delegate = self;
	[self.navigationController pushViewController:controller animated:YES];
    [controller release];
    controller = nil;
	
	
}
BR,

STefan
StefanL is offline   Reply With Quote
Reply

Bookmarks

Tags
back-button, controller, navigationitem, uinavigation, view

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: 235
15 members and 220 guests
@sandris, ADY, Alsahir, dacapo, Dani77, djohnson, HemiMG, jansan, JasonR, MarkC, mer10, prchn4christ, ryandb2, tomtom100
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 02:00 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0