一、图片视图
1、UIImageView
作用:专用于显示图片的视图。
2、常用属性和方法
实践代码:
UIImageView *imgView = [[UIImageView alloc]initWithFrame:CGRectMake(160-41/2, 100, 41, 30)];
imgView.highlighted = YES;
imgView.image = [UIImage imageNamed:@"005.jpg"];
imgView.highlightedImage = [UIImage imageNamed:@"008.jpg"];
[self.window addSubview:imgView];
UIImageView *imgView1 = [[UIImageView alloc]initWithFrame:CGRectMake(110, 200, 100, 100)];
imgView1.userInteractionEnabled = YES;
imgView1.backgroundColor = [UIColor redColor];
[self.window addSubview:imgView1];
UIButton *button1 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
button1.frame = CGRectMake(10, 20, 80, 30);
[button1 setTitle:@"alertView" forState:UIControlStateNormal];
[imgView1 addSubview:button1];