title: Swift 'Must register a nib or a class for the identifier or connect a prototype cell in a storyboard'
body: <p>I have some basic code, trying to load a UITableView with some cells. I had set cell's ID in Storyboard,and create a swift file and xib for cell named "DemoListCell". I keep getting this error, although i don't use storyboards in my project.
  Any ideas?     Thanks for all of you .</p>
  
  <pre><code>import UIKit
  </code></pre>
  
  <p>// MARK: </p>
  
  <pre><code>class ViewController: UIViewController,UITableViewDataSource {
  let cellId = "DemoListID"
  let TopTableView = UITableView()
  let PageTableView  = UITableView()
  let PageScrollView = UIScrollView()
  var CellsIdentifier:String = ""
  var NumbersofTab:CGFloat = 4
  var Number:CGFloat = 4
  var Size:CGFloat = 0
  var OldPoint:CGFloat = 0
  var NewPoint:CGFloat = 0{
      didSet{
          TopTableView.reloadData()
      }
  }
  
  // MARK: - ViewDidLoad and init()
  override func viewDidLoad() {
  
  
      let TopWidth = self.view.frame.size.width
      Size = TopWidth
      let TopHeight:CGFloat = 50
      let TopY = 0 - (TopWidth - TopHeight)/2
      let TopX = 0 + (TopWidth - TopHeight)/2
      let PageY = TopHeight
      let PageHeight = self.view.frame.size.height - TopHeight
  
      //TopTableView
      TopTableView.frame = CGRectMake(TopX, TopY, TopHeight,TopWidth)
      TopTableView.transform = CGAffineTransformMakeRotation(CGFloat(-M_PI/2))
      TopTableView.showsVerticalScrollIndicator = false
      TopTableView.backgroundColor = UIColor.yellowColor()
      TopTableView.dataSource = self
      TopTableView.delegate = self
  
      //PageTableView
  
  
      PageTableView.frame = CGRectMake(0, 0, TopWidth,PageHeight)
      let nib = UINib(nibName: "DemoListCell", bundle: nil) //Cell's Name
      self.PageTableView.registerNib(nib, forCellReuseIdentifier: cellId)
      PageTableView.backgroundColor = UIColor.blueColor()
  
      //PageScrollView
      PageScrollView.frame = CGRectMake(0, PageY, TopWidth,PageHeight)
      PageScrollView.delegate = self
      PageScrollView.contentSize = CGSize(width: TopWidth * NumbersofTab, height: PageScrollView.frame.height)
      PageScrollView.pagingEnabled = true
      PageScrollView.alwaysBounceHorizontal = false
      PageScrollView.alwaysBounceVertical = false
  
  
  
  
      //addSubview
      self.view.addSubview(TopTableView)
  
      PageScrollView.addSubview(PageTableView)
  
      self.view.addSubview(PageScrollView)
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>// MARK: - UIScrollViewDelegate</p>
  
  <pre><code>extension ViewController: UIScrollViewDelegate{
  func scrollViewWillBeginDragging(scrollView: UIScrollView) {
      OldPoint = PageScrollView.contentOffset.x
  
  }
  func scrollViewDidEndDecelerating(scrollView: UIScrollView) {
      NewPoint = PageScrollView.contentOffset.x
      print("\( NewPoint)")
  }
  </code></pre>
  
  <p>}
  // MARK: - UITableViewDalegate</p>
  
  <pre><code>extension ViewController:UITableViewDelegate{
  
  func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -&gt; UITableViewCell {
      let cell = tableView.dequeueReusableCellWithIdentifier(self.cellId, forIndexPath: indexPath) as! DemoListCell
      if tableView.isEqual(TopTableView){
      var cell:TopTableViewCell! = tableView.dequeueReusableCellWithIdentifier("cd") as? TopTableViewCell
      if (cell == nil) {
          cell = TopTableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: "cd")
          switch indexPath.row{
          case 0:
              cell.backgroundColor = UIColor.greenColor()
          case 1:
              cell.backgroundColor = UIColor.redColor()
          case 2:
              cell.backgroundColor = UIColor.yellowColor()
          case 3:
              cell.backgroundColor = UIColor.whiteColor()
          default:
              cell.backgroundColor = UIColor.grayColor()
          }
      }
  
      cell.TabTitle.text = "\(Int(NewPoint / Size))"
      }
      return cell
  }
  
  func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
      let RowNumber:Int = 1
      switch RowNumber{
      default: return Int(NumbersofTab)
      }
  }
  func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -&gt; CGFloat {
      let NumberofPages = Size / NumbersofTab
      return NumberofPages
  }
  func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
      UIView.animateWithDuration(0.3) { () -&gt; Void in
          let Pages = self.Size * CGFloat(indexPath.row)
          self.PageScrollView.contentOffset = CGPoint(x: Pages, y: 0)
          self.TopTableView.reloadData()
          self.NewPoint = self.PageScrollView.contentOffset.x
      }
  }
  }
  </code></pre>
  
  <p>and this is "CellId" cell's Code:</p>
  
  <pre><code>class DemoListCell: UITableViewCell {
  
  @IBOutlet weak var cellImg: UIImageView!
  @IBOutlet weak var cellLabel: UILabel!
  @IBOutlet weak var cellIcon: UIImageView!
  
  
  override func awakeFromNib() {
      super.awakeFromNib()
      self.cellImg.layer.masksToBounds = true
      self.cellImg.layer.cornerRadius = 20.0
      self.cellImg.layer.borderWidth = 0.0
      self.cellImg.image = UIImage(named: "avatar.jpg")// Initialization code
      self.cellIcon.image = UIImage(named: "Next")
  }
  
  override func setSelected(selected: Bool, animated: Bool) {
      super.setSelected(selected, animated: animated)
  
      // Configure the view for the selected state
  }
  </code></pre>
  
  <p>}</p>
  
  <p>and there is "Cd" cell's Code:</p>
  
  <pre><code>class TopTableViewCell: UITableViewCell {
  
  var TabTitle = UILabel()
  
  override init(style: UITableViewCellStyle, reuseIdentifier: String!) {
      super.init(style: style, reuseIdentifier: reuseIdentifier)
      TabTitle = UILabel(frame: CGRectZero)
      TabTitle.textAlignment = NSTextAlignment.Right
      TabTitle.numberOfLines = 1
      TabTitle.backgroundColor = UIColor.clearColor()
      TabTitle.textColor = UIColor(red: 130/255, green: 137/255, blue: 141/255, alpha: 1.0)
      self.contentView.addSubview(self.TabTitle)
      // 130 137 141
      self.separatorInset = UIEdgeInsets(top: 0, left: 100, bottom: 0, right: -100)
  
  }
  
  required init(coder aDecoder: NSCoder) {
      fatalError("init(coder:) has not been implemented")
  }
  
  override func layoutSubviews() {
  
      let marginX = CGFloat(0.0)
      let marginY = CGFloat(0.0)
      let width = CGFloat(30)
      let height = self.contentView.frame.size.width
      self.TabTitle.transform = CGAffineTransformMakeRotation(CGFloat(M_PI/2))
  
      self.TabTitle.frame = CGRectMake(marginX, marginY, width, height)
  }
  </code></pre>
  
  <p>}</p>