边框颜色为 tintColor 的 UIButton
生活随笔
收集整理的這篇文章主要介紹了
边框颜色为 tintColor 的 UIButton
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
創(chuàng)建一個(gè) UIButton 的子類,重寫其方法:
- (void)drawRect:(CGRect)rect {[[self layer] setCornerRadius:CORNER_RADIUS];[[self layer] setMasksToBounds:YES]; [[self layer] setBorderWidth:1];[[self layer] setBorderColor:self.tintColor.CGColor];[self.imageView setTintColor:self.tintColor]; }- (void)tintColorDidChange {[super tintColorDidChange];[self setNeedsDisplay]; // [[self layer] setBorderColor:self.tintColor.CGColor]; }轉(zhuǎn)載于:https://www.cnblogs.com/ihojin/p/bordered-button-with-tintcolor.html
總結(jié)
以上是生活随笔為你收集整理的边框颜色为 tintColor 的 UIButton的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 使用spring initializat
- 下一篇: 30-- A 代码记录分析