imageview显示图片的部分

来源:互联网 发布:考研通信与网络基础 编辑:程序博客网 时间:2024/04/29 00:45

 imgView.contentMode =UIViewContentModeTopLeft


    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,





    并设置父视图的clipsToBounds为yes

            btn.clipsToBounds =YES;

原创粉丝点击