Can't do custom UIButton in iOS6 with enabled storyboard autolayout

前端 未结 1 350
粉色の甜心
粉色の甜心 2021-01-07 01:06

I faced strange behavior. I\'m using custom styled button which I setup in my controller:

- (void)viewDidLoad
{
    [su         


        
相关标签:
1条回答
  • 2021-01-07 01:47

    In viewDidLoad, under autolayout, your views will not yet have a frame, so you are making the layer have a frame of CGRectZero.

    You need to move this code, or at least the part where you set the frame of the gradient layer, to viewDidLayoutSubviews or similar.

    0 讨论(0)
提交回复
热议问题