//? ? 按鈕UIButton
//? ? UIButton *button = [UIButton buttonWithType:UIButtonTypeInfoDark];
UIButton *button = [[UIButton alloc]initWithFrame:CGRectMake(50, 50, 80, 80)];
//? ? frame 表明了控件的坐標(biāo)和寬高(CGRect 類型)
[button setTitle:@"眼鏡哥" forState:UIControlStateNormal];
UIImage *image = [UIImage imageNamed:@"right_normal"];
//? ? 給按鈕設(shè)置背景圖片
[button setBackgroundImage:image forState:UIControlStateNormal];
button.backgroundColor = [UIColor greenColor];
//? ? 按鈕監(jiān)聽
[button addTarget:self action:@selector(btnClickLister) forControlEvents:(UIControlEventTouchUpOutside)];
//? ? 添加到視圖上面
[self.view addSubview:button];
//? ? 相框UIImageView
UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(150, 50, 200, 200)];
UIImage *image1 = [UIImage imageNamed:@"biaoqingdi"];
//? ? 設(shè)置imageView顯示的圖片
imageView.image = image1;
[self.view addSubview:imageView];
//? ? 標(biāo)簽UILabel
UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(150, 270, 150, 30)];
//? ? 設(shè)置標(biāo)簽的文本
label.text = @"表情弟";
//? ? 設(shè)置居中方式
label.textAlignment = NSTextAlignmentCenter;
label.textColor = [UIColor grayColor];
[self.view addSubview:label];
}
}
@end