UIImageView的三种方式


UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"图片"]];
    /*
     UIViewContentModeScaleToFill,
     UIViewContentModeScaleAspectFit,      // contents scaled to fit with fixed aspect. remainder is transparent
     UIViewContentModeScaleAspectFill,
     */
    imgView.contentMode = UIViewContentModeScaleAspectFit;

Fill(填充) Fit(试用)Aspect(方向)scale(比例)

  • 如果子类view比父类的view大 那么它的坐标为负的, bounds为本身

你可能感兴趣的:(UIImageView的三种方式)