I do this quite a bit in my code:
self.sliderOne.frame = CGRectMake(newX, 0, self.sliderOne.frame.size.width, self.sliderOne.frame.size.height);
Yeah, you have to do:
CGRect newFrame = self.sliderOne.frame;
newFrame.origin.x = frame.size.width - MARGIN * 2 - totalWidth;
self.sliderOne.frame = newFrame;
It sucks, I know. If you find yourself doing this a lot, you may want to add categories to UIView/NSView to alter this stuff for you:
@interface UIView (FrameMucking)
- (void) setWidth:(CGFloat)newWidth;
@end
@implementation UIView (FrameMucking)
- (void) setWidth:(CGFloat)newWidth {
CGRect f = [self frame];
f.size.width = newWidth;
[self setFrame:f];
}
@end
Etc.