0
В моем cellForRowAtIndexPath
методе я поставил cornerRadius
в layer
на моем изображении:Почему изменение этого CALayer в UITableViewCell вызывает неприятный графический сбой?
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("feedCell")!
if self.pictunes?.count > 0 {
// There are some pictunes to show; Create and update the posts
if self.pictuneImages.count > indexPath.row {
// We have an image for the user who made the current pictune
if let pictunerImageView = cell.contentView.viewWithTag(2) as? UIImageView {
pictunerImageView.layer.cornerRadius = 17.5 // Cut it to a circle
pictunerImageView.image = self.pictunerImages[0]
}
// We also have an image for the pictune at the current post
if let pictuneImageView = cell.contentView.viewWithTag(1) as? UIImageView {
pictuneImageView.image = self.pictuneImages[indexPath.row]
}
}
return cell
} else {
// No pictunes have loaded yet; We probably need more time
// to load the image and audio assets for some of them
cell.textLabel!.text = "No Pictunes Available Yet"
return cell
}
}
Но когда я прокручиваю я вижу этот неприятный фон эффект:
Как мне избавиться от этот эффект? Очистка фонового контекста не помогла. Благодаря!
Гиф слишком мал, чтобы действительно видеть, о чем вы говорите, но я предполагаю, что вам нужно сказать pictunerImageView.layer.masksToBounds = true после того, как вы установите cornerRadius – beyowulf
, о котором он говорит, является тот факт, что при прокрутке нижние два угла изображения профиля округлены - если он достигает вершины, это изменяется, а верхние два угла округляются. – luk2302
^Точно. Извините, что GIF настолько мал. Существует ограничение в 2 МБ. Я попробую добавить 'masksToBounds' к' true', как вы предложили, beyowulf. – IIllIIll