UI控件

作者: 云翻拥成夏 | 来源:发表于2016-07-11 18:28 被阅读0次

    #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控件

          本文链接:https://www.haomeiwen.com/subject/ovjjjttx.html