1. 程式人生 > 其它 >OC Control FHXBtn(按鍵)

OC Control FHXBtn(按鍵)

技術標籤:UI的封裝androidobjective-cxcode

一直覺得自己寫的不是技術,而是情懷,一個個的教程是自己這一路走來的痕跡。靠專業技能的成功是最具可複製性的,希望我的這條路能讓你們少走彎路,希望我能幫你們抹去知識的蒙塵,希望我能幫你們理清知識的脈絡,希望未來技術之巔上有你們也有我。

在這裡插入圖片描述

Left圖片

在這裡插入圖片描述

    self.btn = [FHXLeftIconBtn new];
    self.btn.icon.img(@"home_search_normal");
    self.btn.iconSize = 20;
    self.btn.iconLeftDistance =
10; self.btn.titleLeftDistance = 5; self.btn.titlelLabel.str(@"搜尋").fnt(14); self.btn.titlelLabel.textColor = [UIColor whiteColor]; self.btn.addTo(self.view).border(1,[UIColor whiteColor]).borderRadius(15).bgColor([[UIColor blackColor] colorWithAlphaComponent:0.3]).makeCons(
^{ make.centerX.equal.view(self.view); make.top.equal.view(self.view).constants(250); make.width.equal.constants(80); make.height.equal.constants(30); });

在這裡插入圖片描述

    self.btn = [FHXLeftIconCenterBtn new];
    self.btn.icon.img(@"home_search_normal");
    self.btn.iconSize =
25; self.btn.titleCenterXDistance = 10; self.btn.iconRightDistance = -1; self.btn.titlelLabel.str(@"搜尋").fnt(14); self.btn.titlelLabel.textColor = [UIColor whiteColor]; self.btn.addTo(self.view).border(1,[UIColor whiteColor]).borderRadius(4).bgColor([[UIColor blackColor] colorWithAlphaComponent:0.3]).makeCons(^{ make.centerX.equal.view(self.view); make.top.equal.view(self.view).constants(250); make.width.equal.constants(70); make.height.equal.constants(30); });

Left文字

在這裡插入圖片描述

    self.attentionBtn = [FHXLeftTitleBtn new];
    self.attentionBtn.icon.img(@"home_search_normal");
    self.attentionBtn.iconSize = 20;
    self.attentionBtn.iconLeftDistance = 5;
    self.attentionBtn.titleLeftDistance = 15;
    self.attentionBtn.titlelLabel.str(@"搜尋").fnt(14);
    self.attentionBtn.titlelLabel.textColor = [UIColor whiteColor];
    self.attentionBtn.bgColor = [[UIColor blackColor] colorWithAlphaComponent:0.3];
    self.attentionBtn.addTo(self.view).border(1,[UIColor whiteColor]).borderRadius(15).makeCons(^{
      make.centerX.equal.view(self.view);
      make.top.equal.view(self.view).constants(250);
      make.width.equal.constants(80);
      make.height.equal.constants(30);
    });

在這裡插入圖片描述

    @property (nonatomic,strong) FHXLeftTitleCenterBtn *btn;

    self.btn = [FHXLeftTitleCenterBtn new];
    self.btn.icon.img(@"home_search_normal");
    self.btn.iconSize = 25;
    self.btn.titleCenterXDistance = -10;
    self.btn.iconLeftDistance = 5;
    self.btn.titlelLabel.str(@"搜尋").fnt(14);
    self.btn.titlelLabel.textColor = [UIColor whiteColor];
    self.btn.addTo(self.view).border(1,[UIColor whiteColor]).borderRadius(4).bgColor([[UIColor blackColor] colorWithAlphaComponent:0.3]).makeCons(^{
      make.centerX.equal.view(self.view);
      make.top.equal.view(self.view).constants(250);
      make.width.equal.constants(70);
      make.height.equal.constants(30);
    });

topIcon

在這裡插入圖片描述

@property (nonatomic,strong) FHXTopIconBtn *btn;

    self.btn = [FHXTopIconBtn new];
    self.btn.icon.img(@"home_search_normal");
    self.btn.iconSize = 30;
    self.btn.iconTopDistance = 5;
    self.btn.titleTopDistance = 5;
    self.btn.titlelLabel.str(@"搜尋").fnt(14);
    self.btn.titlelLabel.textColor = [UIColor whiteColor];
    self.btn.addTo(self.view).border(1,[UIColor whiteColor]).borderRadius(4).bgColor([[UIColor blackColor] colorWithAlphaComponent:0.3]).makeCons(^{
      make.centerX.equal.view(self.view);
      make.top.equal.view(self.view).constants(250);
      make.width.equal.constants(40);
      make.height.equal.constants(60);
    });