然而,当视图加载到图像的第一个初始载荷上时,它们就像小钻石一样出现.当我旋转设备(也旋转表格视图)时,它会自动恢复全尺寸图像,也具有圆度.
这是初始加载的示例图像,
有人知道为什么会这样吗?
这是我的tableVIEw代码
- (UItableVIEwCell *)tableVIEw:(UItableVIEw *)tableVIEw cellForRowAtIndexPath:(NSIndexPath *)indexPath{ static Nsstring *CellIDentifIEr = @"Cell"; UItableVIEwCell *cell = [tableVIEw dequeueReusableCellWithIDentifIEr:CellIDentifIEr forIndexPath:indexPath]; NSDictionary *generatedUsers = [self.randomlyGeneratedUsersArray objectAtIndex:indexPath.row]; NSURL *url = [NSURL URLWithString:[generatedUsers valueForKeyPath:@"user.picture"]]; cell.textLabel.text = [Nsstring stringWithFormat:@"%@ %@",[generatedUsers valueForKeyPath:@"user.name.first"],[generatedUsers valueForKeyPath:@"user.name.last"]]; cell.detailTextLabel.text = [generatedUsers valueForKeyPath:@"user.location.street"]; [cell.imageVIEw setimageWithURL:url placeholderImage:[UIImage imagenamed:@"placeholder"]]; cell.imageVIEw.layer.cornerRadius = 50.0f; cell.imageVIEw.layer.masksToBounds = YES; return cell;}解决方法 你确定自动布局之类的东西在运行时没有改变你的imageVIEw高度吗?
尝试设置角半径,如下所示:
cell.imageVIEw.layer.corderRadius = (cell.imageVIEw.bounds.size.height /2);//And to try figure out what's going on...NSLog(@"Cell imagevIEw height: %f",cell.imageVIEw.bounds.size.height);总结
以上是内存溢出为你收集整理的ios – 尝试圆形图像,输出菱形?全部内容,希望文章能够帮你解决ios – 尝试圆形图像,输出菱形?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)