UI控件

#import"ViewController.h"

//标题标签

@property(nonatomic,strong)UILabel*titleLabel;

@interfaceView@interfaceViewController ()

//左边按钮

@property(nonatomic,strong)UIButton*leftBtn;

//右边按钮

@property(nonatomic,strong)UIButtont*rightBtn;

//显示图片

@property(nonatomic,strong)UIImageView*myImageView;

//定义数组名

@property(nonatomic,strong)NSArray*imageNames;

@end

@implementationViewController

- (void)viewDidLoad {

[superviewDidLoad];

self.imageNames=@[@"biaoqingdi",@"bingli",@"chiniupa",@"danteng",@"wangba"];

//定义标签位置与名称

self.titleLabel= [[UILabelalloc]initWithFrame:CGRectMake(150,50,150,30)];

self.titleLabel.text=@"biaoqingdi";

[self.viewaddSubview:self.titleLabel];

//定义做按钮的位置

self.leftBtn= [[UIButtonalloc]initWithFrame:CGRectMake(20,150,45,45)];

//关闭交互

self.leftBtn.userInteractionEnabled=NO;

//定义按钮的图片

UIImage*leftImage = [UIImageimageNamed:@"left_disable"];

//设置左按钮的背景图片

[self.leftBtnsetBackgroundImage:leftImage

forState:(UIControlStateNormal)];

[self.view addSubview:self.leftBtn];

//显示相框名称

self.myImageView= [[UIImageViewalloc]initWithFrame:CGRectMake(85,100,200,200)];

UIImage*image = [UIImageimageNamed:@"biaoqingdi"];

self.myImageView.image= image;

//显示相框图片

[self.viewaddSubview:self.myImageView];

//设置右按钮的位置

self.rightBtn=[[UIButtonalloc]initWithFrame:CGRectMake(305,150,45,45)];

你可能感兴趣的:(UI控件)