iphone – UITableView Cell中的图像太大了

iphone – UITableView Cell中的图像太大了,第1张

概述我在用: NSString *thearticleImage = entry.articleImage; NSRegularExpression *expression = [NSRegularExpression regularExpressionWithPattern:@"(?i)\\b((?:[a-z][\\w-]+:(?:/{1,3}|[a-z0-9%])|www\\d{0,3}[ 我在用:

Nsstring *thearticleImage = entry.articleImage;    NSRegularExpression *Expression = [NSRegularExpression regularExpressionWithPattern:@"(?i)\b((?:[a-z][\w-]+:(?:/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'\".,<>?«»“”‘’]))" options:NSRegularExpressionCaseInsensitive error:NulL];    Nsstring *someString = thearticleImage;    self.theurl = [someString substringWithRange:[Expression rangeOfFirstMatchInString:someString options:NSMatchingCompleted range:NSMakeRange(0,[someString length])]];    NSURL *picimage = [NSURL URLWithString:theurl];    NSData * urlData = [NSData dataWithContentsOfURL: picimage];    UIImage * imageweb = [UIImage imageWithData: urlData];    cell.imageVIEw.frame = CGRectMake(0,70,70);    cell.imageVIEw.image = imageweb;

问题是这会占用整个单元格,我不确定为什么它不仅仅在左侧.

解决方法 我的表格细胞图像遇到了类似的问题.我使用以下内容来缩放图像:

UIImage *imageOne = [UIImage imagenamed:[imagesArray objectAtIndex:indexPath.row]];cell.imageVIEw.image = [UIImage imageWithCGImage:imageOne.CGImage scale:imageOne.size.wIDth/40 orIEntation:imageOne.imageOrIEntation];

注意:考虑上面的“40”表示您希望图像有多少像素宽.

总结

以上是内存溢出为你收集整理的iphone – UITableView Cell中的图像太大了全部内容,希望文章能够帮你解决iphone – UITableView Cell中的图像太大了所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1019130.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-23
下一篇 2022-05-23

发表评论

登录后才能评论

评论列表(0条)

保存