A small UITableViewCell subclass in swift for this radial animation... Have fun :-)
GitHub Link:
1 2 3 4 5 6 7 8 9 10 11 12 | func imageFromText(#text:String,font:UIFont,color:UIColor)->UIImage { let size : CGSize = (text as NSString).sizeWithAttributes([NSFontAttributeName: font]) UIGraphicsBeginImageContextWithOptions(size, false, 0.0) (text as NSString).drawAtPoint(CGPointMake(0.0, 0.0), withAttributes: [NSFontAttributeName: font, NSForegroundColorAttributeName:color]) let image : UIImage = UIGraphicsGetImageFromCurrentImageContext() UIGraphicsEndImageContext() return image } |
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell
{
var cellIdentifier = "resultCell"
var cell : UITableViewCell = tableView.dequeueReusableCellWithIdentifier(cellIdentifier, forIndexPath: indexPath) as UITableViewCell
var bgView : UIView = UIView()
bgView.backgroundColor = UIColor(red: 123.0/255.0, green: 156.0/255.0, blue: 210.0/255.0, alpha: 1.0)
cell.selectedBackgroundView = bgView
return cell
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell
{
var cellIdentifier = "resultCell"
var cell : UITableViewCell = tableView.dequeueReusableCellWithIdentifier(cellIdentifier, forIndexPath: indexPath) as UITableViewCell
var bgView : UIView = UIView()
bgView.backgroundColor = UIColor(red: 123.0/255.0, green: 156.0/255.0, blue: 210.0/255.0, alpha: 1.0)
cell.selectedBackgroundView = bgView
return cell
}