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

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

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

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.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 09-15-2010, 01:19 AM   #1 (permalink)
Registered Member
 
Join Date: May 2009
Posts: 31
Zala is on a distinguished road
Default Programmatically add a button to UIToolbar

hi all,

i am currently trying to add a button to UIToolbar.

i built a Toolbar in the interfacebuilder (Main.xib)


i am trying to display the Toolbar in another class with the buttons (class2)

Code:
//show main toolbar
main.toolBar.hidden = NO;

//attempt to add button to the toolbar 
UIBarButtonItem *Button1 = [[UIBarButtonItem alloc] initWithTitle:@"item"];
		[Button1 release];

much appreicated
Zala is offline   Reply With Quote
Old 09-15-2010, 08:05 PM   #2 (permalink)
Registered Member
 
Join Date: May 2009
Posts: 31
Zala is on a distinguished road
Default

Quote:
Originally Posted by Zala View Post
hi all,

i am currently trying to add a button to UIToolbar.

i built a Toolbar in the interfacebuilder (Main.xib)


i am trying to display the Toolbar in another class with the buttons (class2)

Code:
//show main toolbar
main.toolBar.hidden = NO;

//attempt to add button to the toolbar 
UIBarButtonItem *Button1 = [[UIBarButtonItem alloc] initWithTitle:@"item"];
		[Button1 release];

much appreicated

any help anyone?
Zala is offline   Reply With Quote
Old 09-16-2010, 02:52 AM   #3 (permalink)
iPhone Developer
 
d_amal's Avatar
 
Join Date: Nov 2009
Location: chennai, india.
Age: 26
Posts: 60
d_amal is on a distinguished road
Send a message via Yahoo to d_amal Send a message via Skype™ to d_amal
Default

Quote:
Originally Posted by Zala View Post
any help anyone?
Try this code ,
UIBarButtonItem *item1 = [[UIBarButtonItem alloc] initWithTitle:@"Item" style:UIBarButtonItemStyleBordered target:self action:@selector(action];

UIBarButtonItem *item2 = [[UIBarButtonItem alloc] initWithTitle:@"Item1" style:UIBarButtonItemStyleBordered target:self action:@selector(action];

NSArray *buttons = [NSArray arrayWithObjects: item1, item2, nil];
[toolBar setItems: buttons animated:NO];

[item1 release];
[item2 release];
d_amal is offline   Reply With Quote
Reply

Bookmarks

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: 322
19 members and 303 guests
2ndSegment, bignoggins, cayladv57, cgokey, dermotos, djohnson, Domele, guusleijsten, Hamad, heshiming, linkmx, markuschow, Objective Zero, pungs, Rudy, Sloshmonster, teebee74, v1n2e7t
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,655
Threads: 94,116
Posts: 402,889
Top Poster: BrianSlick (7,990)
Welcome to our newest member, pungs
Powered by vBadvanced CMPS v3.1.0

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