自定義UIButton的話需要重寫三個方法:
-(CGRect)titleRectForContentRect:(CGRect)contentRect;
設置按鈕標題的frame
-(CGRect)imageRectForContentRect:(CGRect)contentRect;
設置圖片標題的frame
-(instancetype)initWithFrame:(CGRect)frame;
設置按鈕與標題的顯示樣式
在其中設置文字和圖片的位置、內容。
自定義UIButton的話需要重寫三個方法:
-(CGRect)titleRectForContentRect:(CGRect)contentRect;
設置按鈕標題的frame
-(CGRect)imageRectForContentRect:(CGRect)contentRect;
設置圖片標題的frame
-(instancetype)initWithFrame:(CGRect)frame;
設置按鈕與標題的顯示樣式
在其中設置文字和圖片的位置、內容。