Puoi semplicemente sottoclasse UIButton e implementare il disegno personalizzato al suo interno. UIButton è il modo più semplice per eseguire l'operazione senza interferire con i tocchi della vista tabella. Se implementi il gesto del tocco sulla vista tabella, causerà problemi ai tocchi della cella.
È possibile ottenere semplicemente l'immagine personalizzata (sia + segno che testo come un'immagine) e utilizzarla come immagine di sfondo.
Oppure puoi anche disegnarlo con il codice.
Ad esempio, si può provare questo:
func drawCanvas1(frame frame: CGRect = CGRectMake(3, 8, 209, 109)) {
//// General Declarations
let context = UIGraphicsGetCurrentContext()
//// Color Declarations
let color = UIColor(red: 0.967, green: 0.423, blue: 0.211, alpha: 1.000)
//// Image Declarations
let screenShot20151111At32900PM = UIImage(named: "screenShot20151111At32900PM.png")!
//// Rectangle Drawing
let rectanglePath = UIBezierPath(roundedRect: CGRectMake(frame.minX + 39, frame.minY + 23, 113, 46), cornerRadius: 8)
color.setFill()
rectanglePath.fill()
//// Rectangle 2 Drawing
let rectangle2Rect = CGRectMake(frame.minX + 51, frame.minY + 27, 33, 34)
let rectangle2Path = UIBezierPath(rect: rectangle2Rect)
CGContextSaveGState(context)
rectangle2Path.addClip()
screenShot20151111At32900PM.drawInRect(CGRectMake(floor(rectangle2Rect.minX - 16 + 0.5), floor(rectangle2Rect.minY - 15 + 0.5), screenShot20151111At32900PM.size.width, screenShot20151111At32900PM.size.height))
CGContextRestoreGState(context)
//// Text Drawing
let textRect = CGRectMake(frame.minX + 97, frame.minY + 23, 73, 46)
let textTextContent = NSString(string: "\nfollow\ntrip\n")
let textStyle = NSParagraphStyle.defaultParagraphStyle().mutableCopy() as! NSMutableParagraphStyle
textStyle.alignment = .Left
let textFontAttributes = [NSFontAttributeName: UIFont.systemFontOfSize(UIFont.labelFontSize()), NSForegroundColorAttributeName: UIColor.whiteColor(), NSParagraphStyleAttributeName: textStyle]
let textTextHeight: CGFloat = textTextContent.boundingRectWithSize(CGSizeMake(textRect.width, CGFloat.infinity), options: NSStringDrawingOptions.UsesLineFragmentOrigin, attributes: textFontAttributes, context: nil).size.height
CGContextSaveGState(context)
CGContextClipToRect(context, textRect);
textTextContent.drawInRect(CGRectMake(textRect.minX, textRect.minY + (textRect.height - textTextHeight)/2, textRect.width, textTextHeight), withAttributes: textFontAttributes)
CGContextRestoreGState(context)
}
e il risultato sarà qualcosa di simile:

si può solo fare un arancio con segno più come immagine di sfondo per il pulsante e il diritto di allineare l'etichetta viaggio follow, o anche puoi aggiungere un pulsante personalizzato della stessa dimensione della tua vista e aggiungerlo alla tua vista con sfondo trasparente e senza etichetta in modo da poterlo fare clic su –
I tocchi vengono "assorbiti" da "UITableView". Aggiungi invece un riconoscitore di gesti a 'UITableView' e usa le coordinate per capire quale cella e quale pulsante è stato cliccato. –
per me un'implementazione come la tua è totalmente funzionante! sei sicuro di aver impostato tutto correttamente? –