I am making a very simple app, that has an UIButton and an UIImageView. Every time the user taps the button the image width increases by 5. My question is, how can I limit the width of the image? lets say, if it reaches 90 then prevent the image from increasing its width. What do I need to implement in my code?
Here is my code:
File.h
@interface ViewController : UIViewController
{
IBOutlet UIButton *buttonOne;
IBOutlet UIImageView *imageOne;
}
-(IBAction)buttonOne:(id)sender;
@end
File.m
@implementation ViewController
-(IBAction)buttonOne:(id)sender{
imageOne.frame = CGRectMake(100, 31, imageOne.frame.size.width + 5, 28);
}
@end
Any help would be greatly appreciated!
Thank you in advance!
imageOne.frame = CGRectMake(100, 31, MIN(90, imageOne.frame.size.width + 5), 28);