title: iOS swift data does not match cell as i scroll down
body: <p>I'm having this problem whereby when I click my ReadMore button which is prepared by segue, I got a wrong value --> cidCTV (its a ID no. in my database). There is no errors in the code, I just couldn't pass the correct value to my next controller. 
  P.S. I did a println to test the value loaded in the cell and as I scroll down, the value jumped to the next before the next cell is fully view.<br>
  Is there a way to set all my value esp my cidCTV to all the cells before I start scrolling? Or could it be my storyboard alignment for the cell is wrong or something?</p>
  
  <p>My struct</p>
  
  <pre><code>class Entry : NSObject {
  
  var color : String = String()
  var divider : String = String()
  var cid : String = String()
  
  
  var image : String = String()
  var heading : String = String()
  var title : String = String()
  var desc : String = String()
  }
  
  class ChapterData : NSObject {
  var newEntryArray : Array&lt;Entry&gt; = [];
  }
  </code></pre>
  
  <p>this is my ChapterTableViewController.swift</p>
  
  <pre><code>import Foundation
  import UIKit
  
  class ChapterTableViewController: UITableViewController {
  
  var cidCTV : String = "";  
  
  var pa55DB : COpaquePointer = nil
  var selectStatement : COpaquePointer = nil;
  var sqlString : String = "";
  
  var arrEntryInfo : ChapterData = ChapterData()
  
  override func viewDidLoad() {
      super.viewDidLoad()
  
      openDB()
      arrEntryInfo = executeSelect()
  
      println("Testing...")
  }
  
  func openDB() {
      var paths = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0] as! String
      var docsDir = paths.stringByAppendingPathComponent("pa55.sqlite")
  
      if (sqlite3_open(docsDir, &amp;pa55DB) == SQLITE_OK) {
          println("success open database")
      }
      else {
          println("failed to open database")
      }
  }
  
  func executeSelect() -&gt; ChapterData   {
      sqlString = "SELECT * FROM Chapter where SHOW = 'true' ORDER BY CID ASC"
      var cSql = sqlString.cStringUsingEncoding(NSUTF8StringEncoding)
      sqlite3_prepare_v2(pa55DB, cSql!, -1, &amp;selectStatement, nil)
  
      println("startment start")
  
      var localEntryInfo : ChapterData = ChapterData()
  
      while (sqlite3_step(selectStatement) == SQLITE_ROW) {
          var entryInfo: Entry = Entry()
  
          let cid_buf = sqlite3_column_text(selectStatement, 0)
          var cid1 = String.fromCString(UnsafePointer&lt;CChar&gt;(cid_buf))
  
          let image_buf = sqlite3_column_text(selectStatement, 3)
          var image1 = String.fromCString(UnsafePointer&lt;CChar&gt;(image_buf))
  
          let heading_buf = sqlite3_column_text(selectStatement, 1)
          var heading1 = String.fromCString(UnsafePointer&lt;CChar&gt;(heading_buf))
  
          let title_buf = sqlite3_column_text(selectStatement, 2)
          var title1 = String.fromCString(UnsafePointer&lt;CChar&gt;(title_buf))
  
          let desc_buf = sqlite3_column_text(selectStatement, 4)
          var description1 = String.fromCString(UnsafePointer&lt;CChar&gt;(desc_buf))
  
          let divider_buf = sqlite3_column_text(selectStatement, 5)
          var divider1 = String.fromCString(UnsafePointer&lt;CChar&gt;(divider_buf))
  
          let color_buf = sqlite3_column_text(selectStatement, 7)
          var color1 = String.fromCString(UnsafePointer&lt;CChar&gt;(color_buf))
  
          entryInfo.cid = cid1!;
          entryInfo.image = image1!;
          entryInfo.heading = heading1!;
          entryInfo.title = title1!;
          entryInfo.desc = description1!;
          entryInfo.divider = divider1!;
          entryInfo.color = color1!;
  
          localEntryInfo.newEntryArray.append(entryInfo)
      }
      println("select statement successful executed")
      return localEntryInfo
  }
  
  override func didReceiveMemoryWarning() {
      super.didReceiveMemoryWarning()
      // Dispose of any resources that can be recreated.
  }
  
  //MARK: navigation title
  
  override func viewDidAppear(animated: Bool) {
  
      //navigation bar title image
      var nav = self.navigationController?.navigationBar
  
      let imageView = UIImageView(frame: CGRect(x: 0, y: 0, width: 45, height: 32.5))
      imageView.contentMode = .ScaleAspectFit
  
      let image = UIImage(named: "we_logo.jpg")
      imageView.image = image
  
      navigationItem.titleView = imageView
      navigationController!.navigationBar.barTintColor = UIColor.whiteColor()
  }
  
  
  // MARK: - Table view data source
  
  override func numberOfSectionsInTableView(tableView: UITableView) -&gt; Int {
      return 1
  }
  
  override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
      return arrEntryInfo.newEntryArray.count
  }
  
  override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -&gt; UITableViewCell {
      var cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as! ChapterTableViewCell
  
      var entry1 : Entry  = arrEntryInfo.newEntryArray[indexPath.row]
  
      let color : NSString = entry1.color
      cell.dividerLabel.backgroundColor = hexStringToUIColor(color as String)
  
      cell.dividerLabel.text = entry1.divider
      cell.imageLabel.image = UIImage(named: entry1.image)
      cell.headingLabel.text = entry1.heading
      cell.titleLabel.text = entry1.title
      cell.descLabel.text = entry1.desc
      cell.readMoreButton.tag = (entry1.cid).toInt()!
  
      return cell
  }
  
  /*
  override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
      var entry1 : Entry = arrEntryInfo.newEntryArray[indexPath.row]
      cidCTV = entry1.cid
  }
  */
  
  @IBAction func shareChapter(sender: UIButton) {
  
      var shareChapter = "http://pa55.eu.pn/Pa55.html"
  
      let shareChapterC : UIActivityViewController = UIActivityViewController(activityItems: [shareChapter], applicationActivities: nil)
  
      self.presentViewController(shareChapterC, animated: true, completion: nil)
  }
  
  override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject!) {
      if (segue.identifier == "ReadMoreSegue") {
          var svc = segue.destinationViewController as! ChapterStoryController;
          println("the cid value is \(cidCTV)")
      //    svc.dataPassed = cell.readMoreButton.tag
      }
  }
  }
  </code></pre>