Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于图片的显示 #2

Open
mrhyh opened this issue May 19, 2016 · 2 comments
Open

关于图片的显示 #2

mrhyh opened this issue May 19, 2016 · 2 comments

Comments

@mrhyh
Copy link

mrhyh commented May 19, 2016

楼主,你的项目很棒,向你请教一个问题,这里面的图片显示你是怎么处理的呢?比如遇到不规则的图片,那几种显示图片的方式并不能完全满足要求,如果进行裁剪,图片就会变模糊.你是怎么处理的呢?

@NotFound9
Copy link
Owner

NotFound9 commented May 20, 2016

@mrhyh
您好!感谢您关注这个项目,不知道您说的是哪里的图片显示,如果是指图片模块中的每个cell中的搞笑图片,我是依据原图的宽高比来计算imageView的宽和高(宽是固定的,是屏幕的宽度,高是根据宽高比计算所得)
1.如果计算得到的高度在正常范围内(小于[UIScreen mainScreen].bounds.size.height-64-40)
那么会显示图片的全部,将imageView的contentMode设置为 UIViewContentModeScaleToFill;

2.如果计算得到的高度非常大(大于[UIScreen mainScreen].bounds.size.height-64-40)
如果计算的高度超出一定值,那么只会显示图片的中间部分,不需要裁剪和绘制,只需将imageView的contentMode设置为UIViewContentModeScaleAspectFill;
并且在imageView下方会有一个查看大图的按钮。

感谢您对TTNew的关注!谢谢!

@mrhyh
Copy link
Author

mrhyh commented May 24, 2016

明白了,谢谢楼主

gitbook-com bot pushed a commit to lipf1024/interviewGuide that referenced this issue Apr 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants