本文用來記錄自己開發(fā)過程中遇到的問題,以及好的第三方等等。
文字在左,圖片在右;文字在右,圖片在左;文字在上,圖片在下;文字在下,圖片在上;
使用自定義view,image加label,然后view上面加手勢實現(xiàn),按鈕的點擊事件封裝在block中。
github鏈接??github鏈接 :https://github.com/dsc7219356/customButton
實現(xiàn)代碼如下:
CustomButton *button1 = [[CustomButton alloc]initWithFrame:(CGRect){(CGRectGetWidth(self.view.frame)-100)/2,80,100,100}
type:CustomButtonTopImageType
imageSize:CGSizeMake(50, 50) midmargin:10];
button1.isShowSelectBackgroudColor = YES;
button1.imageView.image = [UIImage imageNamed:@"image"];
button1.backgroundColor = [UIColor whiteColor];
button1.titleLabel.text = @"朋友圈";
[self.view addSubview:button1];
[button1 touchAction:^(CustomButton * _Nonnull button) {
NSLog(@"上圖標,下文字");
}];