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 06-12-2010, 06:46 PM   #1 (permalink)
Registered Member
 
Join Date: Jun 2010
Posts: 5
zinitine is on a distinguished road
Default AutoresizeMask in UITableViewCell Issues

Nevermind! I found out the issue. Just incase anyone else ever finds this thread and is looking for the fix, the issue was that I needed to set the frame outside the if statement, like so:

Code:
if ([self segCont] == nil) {
	[self setSegCont:[[UISegmentedControl alloc] init]];
	[[self segCont] insertSegmentWithTitle:@"1" atIndex:0 animated:NO];
	[[self segCont] insertSegmentWithTitle:@"2" atIndex:1 animated:NO];
	[[self segCont] insertSegmentWithTitle:@"3" atIndex:2 animated:NO];
	[[self segCont] setMomentary:YES];
	[[self segCont] addTarget:self action:@selector(pushPriorityView:) forControlEvents:UIControlEventValueChanged];
	[[self segCont] setAutoresizingMask:UIViewAutoresizingFlexibleWidth];
}
[[self segCont] setFrame:CGRectMake(-1.0, -1.0, 301.0, 46.0)];
[[cell contentView] addSubview:[self segCont]];
[cell setAccessoryType:UITableViewCellAccessoryNone];
---Original Post---

Hi! I'm having an issue with an AutoresizingMask in a UITableViewCell. At first, all looks normal.

However, after one turns the device to landscape and scrolls down:

Then, if you go up and scroll down again:


As you can see, it just keeps getting bigger and bigger! I want it to stay the width of the cell.

It may be useful to note that this only happens when it is goes out of view then comes back in (either through scrolling, or sometimes through pushing then popping a subview). On the iPad, for example, when you rotate it fills the cell properly every time when rotated, but can still go weird when pushed then popped.

Code:
if ([self segCont] == nil) {
	[self setSegCont:[[UISegmentedControl alloc] initWithFrame:CGRectMake(-1.0, -1.0, 301.0, 46.0)]];
	[[self segCont] insertSegmentWithTitle:@"1" atIndex:0 animated:NO];
	[[self segCont] insertSegmentWithTitle:@"2" atIndex:1 animated:NO];
	[[self segCont] insertSegmentWithTitle:@"3" atIndex:2 animated:NO];
	[[self segCont] setMomentary:YES];
	[[self segCont] addTarget:self action:@selector(pushPriorityView:) forControlEvents:UIControlEventValueChanged];
	[[self segCont] setAutoresizingMask:UIViewAutoresizingFlexibleWidth];
}
[[cell contentView] addSubview:[self segCont]];
[cell setAccessoryType:UITableViewCellAccessoryNone];
Any help on how to stop this will be greatly appreciated!

Zach

Last edited by zinitine; 06-12-2010 at 07:34 PM. Reason: Found the problem. Oops. :P
zinitine is offline   Reply With Quote
Old 06-14-2010, 10:39 AM   #2 (permalink)
Registered Member
 
Join Date: Jun 2010
Location: uk
Posts: 1
bentech is on a distinguished road
Default

Thanks this is really helpful!
bentech is offline   Reply With Quote
Reply

Bookmarks

Tags
autoresizingmask, problem, segmented control, uitableviewcell

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: 331
9 members and 322 guests
Absentia, Domele, fiftysixty, givensur, heshiming, linkmx, michaelhansen, PixelInteractive, Sloshmonster
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,657
Threads: 94,118
Posts: 402,892
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jenniead38
Powered by vBadvanced CMPS v3.1.0

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