So I'm finding this a bit weird. I have a ScrollView, the subviews are a UIView and a Button. I used a custom button and noticed that when a user scrolls the button moved within the scrollview (not my intention) which of course it would!
It is my intention that the scrollview holds an image from the users photo library. However the user may scroll their photo which causes the button to move with it, therefore if they decide to add a different photo to that scrollview the button doesn't react as it's no longer in that pat of the scrollview.
As a workaround I decided to change the size of the button when a user picks from their photo library to match the size of the image. This works, I can see that the button size has changed and when the user scrolls their image the button is still there. However here's the problem, it would seem that the button hit area doesn't change, so even though the button is showing it doesn't react unless I scroll to it's original position within the scrollview.
Any help would be greatly received.
Here's some code I'm currently using:
Code:
if (photo1Holder.image.size.width >= photo1Holder.image.size.height){
[photo1 setContentSize:CGSizeMake(207, 128)];
photo1.zoomScale = 1.00;
UIGraphicsBeginImageContext(CGSizeMake(620,465));
[photo1Holder.image drawInRect:CGRectMake(0,0,620,465)];
UIImage* newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
photo1Holder.image = newImage;
photoButton1.frame = CGRectMake(0, 0, 207, 128); //This is where I resize my button.
photo1.zoomScale = 1.00;
[photo1 setContentSize:CGSizeMake(207, 128)];
}