美文网首页
防止button的图片被挤压

防止button的图片被挤压

作者: 纯阳子_ | 来源:发表于2017-01-19 15:01 被阅读54次

    UIViewContentMode

      typedef enum {
    UIViewContentModeScaleToFill,
    UIViewContentModeScaleAspectFit,      // contents scaled to fit with fixed aspect. remainder is transparent
    UIViewContentModeScaleAspectFill,     // contents scaled to fill with fixed aspect. some portion of content may be clipped.
    UIViewContentModeRedraw,              // redraw on bounds change (calls -setNeedsDisplay)
    UIViewContentModeCenter,              // contents remain same size. positioned adjusted.
    UIViewContentModeTop,
    UIViewContentModeBottom,
    UIViewContentModeLeft,
    UIViewContentModeRight,
    UIViewContentModeTopLeft,
    UIViewContentModeTopRight,
    UIViewContentModeBottomLeft,
    UIViewContentModeBottomRight,
      } UIViewContentMode;
    

    例如:

     //防止button的图片被挤压
     self.playImageBtn.imageView.contentMode = UIViewContentModeScaleAspectFill;

    相关文章

      网友评论

          本文标题:防止button的图片被挤压

          本文链接:https://www.haomeiwen.com/subject/pmeibttx.html