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-08-2011, 10:05 AM   #1 (permalink)
Token farm animal
 
sneaky's Avatar
 
Join Date: Apr 2011
Posts: 321
sneaky is on a distinguished road
Default resizing toolbar buttons on device rotation?

I'm a bit stumped how to resize custom UIBarButtonItem buttons on device rotation. I'm using the builtin toolbar of navigationitem and I roll out my own buttons like this:

Code:
	UIImage *btn0Image = [UIImage imageNamed:@"deleteButtonNormal.png"];
	UIImage *btn0ImageOver = [UIImage imageNamed:@"deleteButtonOver.png"];
	UIButton *b0 = [UIButton buttonWithType:UIButtonTypeCustom];
	b0.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
	b0.frame = CGRectMake(0, 0, 71, 44);
	[b0 setTag:kDeleteButton];
	[b0 setImage:btn0Image forState:UIControlStateNormal];
	[b0 setImage:btn0ImageOver forState:UIControlStateHighlighted];
	[b0 addTarget:self action:@selector(barButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
	UIBarButtonItem *btn0 = [[UIBarButtonItem alloc] initWithCustomView:b0];

... (several more of the same..)

        NSArray *toolbarItems;
        toolbarItems = [[NSArray alloc] initWithObjects:btn0, flexSpace, btn1, fixedSpace, btn2, flexSpace, btn3, nil];
        [self setToolbarItems:toolbarItems];
When I rotate the device the buttons stay their original size. I have tried to play with the autoresizemask property of the UIbutton I create.
setting flexible height works and squashes the button a small bit, I need the width corrected too though. setting flexible width widens the buttons to take up the entire toolbar rather than scale proportionally.

Any suggestions what to do here??
sneaky 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: 385
9 members and 376 guests
apatsufas, JackReidy, jeroenkeij, Sami Gh, tim0504, UMAD, yomo710, yuncarl28
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,672
Threads: 94,121
Posts: 402,904
Top Poster: BrianSlick (7,990)
Welcome to our newest member, yuncarl28
Powered by vBadvanced CMPS v3.1.0

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