UIButton doesn't listen to content mode setting?

后端 未结 16 2146
情话喂你
情话喂你 2020-12-02 08:45

firstButton is a UIButton of type Custom. I\'m programmatically putting three of them across each cell of a table, thusly:

[firstButton setImage:markImage fo         


        
16条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-02 09:16

    If anyone looking for answer that work in iOS 6 and iOS 7 and storyboard:

    You can set image in your storyboard:

    enter image description here

    And then:

    for(UIView* testId in self.subviews) {
        if([testId isKindOfClass:[UIImageView class]])
            [testId setContentMode:UIViewContentModeScaleAspectFill];
    }
    

提交回复
热议问题