Why is UITableViewCell width less than UITableView width
<p>I am trying to create a UITableView programatically. I have a problem with  the cell width, it is fixed at 320 while the table width is 375 for iphone 6 or 414 for iphone 6 plus</p>

<p>How can i make the cell width equal to the width of the table ?</p>

<p>view class :</p>

<pre><code>import UIKit

class ViewController: UIViewController,UITableViewDelegate,UITableViewDataSource {

    override func viewDidLoad() {
        super.viewDidLoad()

        let myTableView = UITableView(frame: self.view.frame)
        myTableView.delegate = self
        myTableView.dataSource = self
        view.addSubview(myTableView)
        // Do any additional setup after loading the view, typically from a nib.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }


    func numberOfSectionsInTableView(tableView: UITableView) -&gt; Int {
        return 1
    }

    func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
        return 1
    }

    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -&gt; UITableViewCell {
        let cell:customTableViewCell = customTableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: "mycell")
        cell.backgroundColor = UIColor.blueColor()
        print("tableView width is \(tableView.frame.size.width)")
        return cell
    }
}
</code></pre>

<p>custom cell class : </p>

<pre><code>import UIKit

class customTableViewCell: UITableViewCell {

    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        configureView()
    }

    required init(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)!
        configureView()
    }

    func configureView() {

        print("cell width is \(self.frame.size.width)")
        print("cell bounds is \(self.contentView.frame.width)")
        let locationLabel = UILabel()
        locationLabel.frame = CGRectMake(0, 0  , self.frame.size.width,self.frame.size.height )
        locationLabel.text = "custom cell"
        locationLabel.backgroundColor = UIColor.blackColor()

        self.addSubview(locationLabel)
        // add and configure subviews here
    }

}
</code></pre>

<p>Result when running the code : </p>

<p>cell width is 320.0<br>
cell bounds is 320.0<br>
tableView width is 414</p>

<p><a href="http://i.stack.imgur.com/DcdJy.png" rel="nofollow">screenshot</a></p>

<p>I am using Xcode 7.3 , Swift 2.2 , iOS 9.3</p>