I'm a little confused where should I declare and how to add a subView to a cell to make the cell shorter in width.
I tried to use func viewWillLayoutSubviews(){} in my tableViewCell class but I can't access the tableView from there...weird..
What do I need to subclass for this to work and where do I need to insert this code?
Currently this code just adds a subview to the cell and kind of floats on top of the cell instead of containing the cell. I'm using it in cellForRowAtIndexPath.
let testFrame : CGRect = cell.contentView.frame
var testView : UIView = UIView(frame: testFrame)
testView.backgroundColor = UIColor.redColor()
testView.alpha=0.5
testView.bounds = CGRectMake(cell.bounds.origin.x,
cell.bounds.origin.y,
cell.bounds.size.width - 50,
cell.bounds.size.height);
//TableViewCell.addSubview(testView)
cell.contentView.addSubview(testView)
return cell