【发布时间】:2015-03-09 15:49:34
【问题描述】:
您好,我正在编写一个聊天应用程序,但我不希望个人资料图片具有拐角半径。这是我的代码。顺便说一句,我使用 Parse 作为后端。
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as UITableViewCell
var imageView = PFImageView()
let user = self.users[indexPath.row]
imageView.layer.cornerRadius = imageView.frame.size.width / 2
imageView.layer.masksToBounds = true
imageView.file = user[PF_USER_PICTURE] as? PFFile
cell.textLabel?.text = user[PF_USER_FULLNAME] as? String
cell.textLabel?.font = UIFont.boldSystemFontOfSize(24)
cell.imageView?.image = imageView.image
return cell
}
更新: 问题是我的 cell.imageview 没有框架。 感谢 Max K 的回答!
【问题讨论】:
标签: ios swift rounded-corners cornerradius