获取UIImage的尺寸

int contentWid = self.view.width ; 
unsigned long width = CGImageGetWidth(image.CGImage) ;
unsigned long height = CGImageGetHeight(image.CGImage) ;

int contentH = (int)(contentWid * height / width) ;

imageView.frame = CGRectMake(0, 0, contentWid, contentH);

暂无评论

相关推荐

MyLinearLayout如何自适应UILabel

我们的需求是这样的,在一个界面里面,有一个UIScrollView,这里我用的是一个三方控件:TPKeyboardAvoidingScrollView …

微信扫一扫,分享到朋友圈

获取UIImage的尺寸