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