最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

IOS開(kāi)發(fā)UIButton(左邊圖片右邊文字效果)

 更新時(shí)間:2016年10月25日 16:40:41   作者:Alina  
本篇文章主要實(shí)現(xiàn)了實(shí)現(xiàn)UIButton左邊圖片,圖片后面緊跟文字效果,類(lèi)似微信發(fā)現(xiàn)功能,有需要的朋友可以了解一下。

在使用UIButton的時(shí)候,需要實(shí)現(xiàn)UIButton左邊圖片,圖片后面緊跟文字效果比較麻煩,簡(jiǎn)單實(shí)現(xiàn)方法具體代碼如下:

(void)viewDidLoad {
  [super viewDidLoad];
  self.view.backgroundColor = RGB(235, 235, 240);
  UIButton *oneButton = [[UIButton alloc] initWithFrame:CGRectMake(0, kHeaderHeight + 8, kScreenWidth, 40)];
  [oneButton setImage:[UIImage imageNamed:@"icon_party_knowledge_rights_obligations"] forState:UIControlStateNormal];
  [oneButton setTitle:@"第一個(gè)" forState:UIControlStateNormal];
  oneButton.titleLabel.font = FONT(12);
  [oneButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  [oneButton setImageEdgeInsets:UIEdgeInsetsMake(2, 8, 0, kScreenWidth - 50)];
  [oneButton setTitleEdgeInsets:UIEdgeInsetsMake(0, 0, 0, kScreenWidth - 100)];
  oneButton.backgroundColor = [UIColor whiteColor];
  [oneButton addTarget:self action:@selector(oneButtonAction:) forControlEvents:UIControlEventTouchUpInside];
  [self.view addSubview:oneButton];
   
  UIButton *twoButton = [[UIButton alloc] initWithFrame:CGRectMake(0, oneButton.maxY + 8, kScreenWidth, 40)];
  [twoButton setImage:[UIImage imageNamed:@"icon_party_knowledge_dues_collection_standard"] forState:UIControlStateNormal];
  [twoButton setTitle:@"第二個(gè)" forState:UIControlStateNormal];
  twoButton.titleLabel.font = FONT(12);
  [twoButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  [twoButton setImageEdgeInsets:UIEdgeInsetsMake(2, 8, 0, kScreenWidth - 50)];
  [twoButton setTitleEdgeInsets:UIEdgeInsetsMake(0, 0, 0, kScreenWidth - 100)];
  twoButton.backgroundColor = [UIColor whiteColor];
  [twoButton addTarget:self action:@selector(twoButtonAction:) forControlEvents:UIControlEventTouchUpInside];
  [self.view addSubview:twoButton];
   
  //右箭頭
  for (int i = 0; i < 2; i++) {
    UIImageView *rightImgView = [[UIImageView alloc] initWithFrame:CGRectMake(kScreenWidth - 20, kHeaderHeight + 20 + i * 48, 7, 12)];
    rightImgView.image = [UIImage imageNamed:@"icon_right"];
    [self.view addSubview:rightImgView];
  }
}

實(shí)現(xiàn)效果:

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論

扶绥县| 广德县| 通山县| 尼玛县| 广宁县| 樟树市| 手游| 宁化县| 五莲县| 云南省| 和静县| 福鼎市| 珠海市| 巴彦淖尔市| 华安县| 亳州市| 长岛县| 英德市| 城固县| 宁明县| 襄樊市| 赤水市| 宁波市| 峨山| 定兴县| 闵行区| 道真| 久治县| 保康县| 盘锦市| 庄河市| 孟村| 九龙坡区| 吉隆县| 新平| 普宁市| 云浮市| 闽侯县| 永平县| 金乡县| 绍兴县|