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 07-04-2011, 12:07 PM   #1 (permalink)
Registered Member
 
Join Date: Jun 2011
Posts: 2
alexandro.gomes is on a distinguished road
Default UIBarButtonItem left position

Estou tentando criar um botao que possa atender 2 orientações. mas quando está em modo horizontal o botão fica para a direita. Alguém tem alguma ideia de como fazer isso?
Meu codigo é esse:

Code:
+(UIBarButtonItem*) createHomeBarButton:(id)target selector:(SEL)selector {
	UIButton *homeButton = [UIButton buttonWithType:UIButtonTypeCustom];
	[homeButton setImage:[UIImage imageNamed:@"bt_navHome.png"] forState:UIControlStateNormal];
	[homeButton sizeToFit];

	homeButton.imageView.autoresizingMask =  UIViewAutoresizingFlexibleHeight;
	homeButton.imageView.contentMode = UIViewContentModeScaleAspectFit;

	[homeButton setAdjustsImageWhenHighlighted:YES];
	[homeButton setReversesTitleShadowWhenHighlighted:YES];
	homeButton.backgroundColor = [UIColor clearColor];
	
	[homeButton addTarget:target action:selector forControlEvents:UIControlEventTouchUpInside];
	homeButton.contentMode = UIViewContentModeScaleAspectFit;
	homeButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
	homeButton.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
	homeButton.autoresizingMask = UIViewAutoresizingFlexibleHeight;
	UIBarButtonItem *homeBarButton = [[UIBarButtonItem alloc] initWithCustomView:homeButton];
	return [homeBarButton autorelease];
}


e abaixo é como está sendo exibido:



e aqui na horizontal:
Attached Images
File Type: png Screen shot 2011-07-04 at 2.19.46 PM.png (10.4 KB, 13 views)
File Type: png Screen shot 2011-07-04 at 2.22.37 PM.png (8.8 KB, 11 views)
alexandro.gomes is offline   Reply With Quote
Old 07-04-2011, 12:20 PM   #2 (permalink)
Super Moderator
 
Join Date: Jan 2011
Posts: 434
Rhade is on a distinguished road
Default

This is predominantly an English-speaking forum.
Rhade is offline   Reply With Quote
Reply

Bookmarks

Tags
custom back navigation, uibarbuttonitem

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: 351
9 members and 342 guests
apatsufas, chemistry, lendo, leostc, Leslie80, lzwasyc, MarkC, SamorodovAlex, VinceYuan
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,664
Threads: 94,120
Posts: 402,898
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Leslie80
Powered by vBadvanced CMPS v3.1.0

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