セル内のテキスト/イメージのサイズを変更しようとしています。しかし、ラベルには、その位置に応じていくつかの丸い角があります。私のようなスニペットを使用して試してみました:ラベルに合うようにセルのサイズを変更し、イメージサイズを設定し、ラベルに丸みのある角がいくつかあります。
let path = UIBezierPath(roundedRect:cell.receivedText!.bounds, byRoundingCorners:[.TopRight, .BottomLeft, .BottomRight], cornerRadii: CGSizeMake(30, 30))
let maskLayer = CAShapeLayer()
maskLayer.path = path.CGPath
cell.receivedText!.layer.mask = maskLayer
と
tableView.estimatedRowHeight = 44
tableView.rowHeight = UITableViewAutomaticDimension
しかし、私は、2つの一緒に仕事を得る傾けます。
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
createConversation()
let cell: ConversationCell = tableView.dequeueReusableCellWithIdentifier("ConversationCell") as! ConversationCell
if conversation.conversationArray[indexPath.row].isAReceivedMessage == true {
cell.receivedText!.text = conversation.conversationArray[indexPath.row].text
cell.receivedText!.textAlignment = .Left
cell.receivedText!.sizeToFit()
cell.receivedProfileImage!.image = self.conversationProfileImage!.image
cell.receivedText!.backgroundColor = UIColor(red: 44/255, green: 99/255, blue: 105/255, alpha: 5/100)
} else {
cell.sentText!.text = conversation.conversationArray[indexPath.row].text
cell.sentText!.textAlignment = .Right
cell.sentText!.backgroundColor = UIColor(red: 204/255, green: 115/255, blue: 115/255, alpha: 1)
cell.sentText!.sizeToFit()
}
return cell
}
これは事前に任意の助け
感謝を達成しようとするものイムです:
はここで仕事をdidntの私の現在のコードマイナススニペットです。
解決方法を見つけましたか?私は同じ問題にぶつかっています。 –