ios - Create a circular TableViewCell indicator like the Apple Mail app -
i trying create circular indicator tableviewcell similar 1 in apple mail app when email marked unread.
i have following code:
var indicator = cashapelayer() var indicatorsize: cgfloat = 10 // standard blue color let bluecolor = uicolor(red: 0, green: 122.0/255.0, blue:1.0, alpha:1) // create circular cashapelayer indicator.bounds = cgrect(x:0, y:0, width:indicatorsize, height:indicatorsize) indicator.position = cgpoint(x: 10, y: 10) indicator.cornerradius = indicator.frame.size.width/2 // add cell sublayer cell.layer.addsublayer(indicator)
while seems job, circle doesn't feel smooth 1 in mail app, corners pixelated almost. i'm not sure if because using cashapelayer. know if there better alternatives.
also can make object of cell opposed layer can call using cell.indicator?
class circleview: uiview { override func drawrect(rect: cgrect) { let context = uigraphicsgetcurrentcontext() self.tintcolor.setfill() cgcontextfillellipseinrect(context, rect) } }
Comments
Post a Comment