代码如下
@interface ParkViewController ()
@property(nonatomic,strong)UIImageView *carView;
@property(nonatomic,strong)UIImageView *carportView;
@end
@implementation ParkViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self initUI];
}
- (void)initUI {
self.view.backgroundColor = [UIColor blackColor];
_carView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"car"]];
_carView.frame = CGRectMake(150, 400, 80, 140);
_carView.contentMode = UIViewContentModeScaleAspectFill;
[self.view addSubview:_carView];
_carportView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"carport"]];
_carportView.frame = CGRectMake(10, 120, 140, 80);
_carportView.contentMode = UIViewContentModeScaleAspectFill;
[self.view addSubview:_carportView];
UIButton *start = [UIButton buttonWithType:UIButtonTypeCustom];
start.frame = CGRectMake(10