I say, just do it programmatically, yes, it can waste several processor cycles, but it will be more interesting.
OK, here we go ...
Let there be 3 UIImageView defined in the title
UIImageView *left; UIImageView *center; UIImageView *right;
In viewDidLoad we will create them
left = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"left.jpg"]]; center = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"center.jpg"]]; right = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"right.jpg"]]; [self.view addSubview:left]; [self.view addSubview:center]; [self.view addSubview:right];
then make a method that you can use to set the position of the center image, and the rest of the images will expand in place, stretching to the edges left and right.
-(void)setCenterFrame:(CGRect)rect { center.frame = rect; // this is your arrow //set size of left left.frame = CGRectMake(0,rect.origin.y, rect.origin.x, rect.size.height); //work out how much space there is to the right float sizeToTheRight = (self.view.bounds.size.width - rect.size.width) - rect.origin.x ; //set size of right right.frame = CGRectMake(rect.size.width + rect.origin.x,rect.origin.y, sizeToTheRight, rect.size.height); }
source share