title: In my Tab Bar View, my TableView cannot load data when launched but data would then appear when I click away and click back
body: <p>I am trying to load a list of titles from reddit.com/.json, but my tableview under a UIViewController would not load data whenever I launch it, the screen would be blank like this:
  <a href="http://imgur.com/ucriMht" rel="nofollow">http://imgur.com/ucriMht</a></p>
  
  <p>I have to click the Downloads Tab and then click back to the Current Sub tab in order for my TableView to properly load data from the json file:
  <a href="http://imgur.com/TJyW65O" rel="nofollow">http://imgur.com/TJyW65O</a></p>
  
  <p>I also attach my code of the ViewController for that tab in this question to see if anyone can spot where I have done wrong.</p>
  
  <pre><code>import UIKit
  
  class CurrentSubViewController: UIViewController,UITableViewDataSource,UITableViewDelegate,NSURLConnectionDelegate,UISearchBarDelegate {
  
      var manager:DataManager = DataManager()
      var localJson:JSON=JSON.nullJSON
      @IBOutlet var tableView : UITableView!
      override func viewWillAppear(animated: Bool) {
          super.viewWillAppear(animated)
      }
      override func viewDidLoad() {
          super.viewDidLoad()
          manager.startConnection()
  
          print("subredditview loaded")
  
          // Do any additional setup after loading the view.
      }
  
  
       func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int
      {
  
          return manager.json["data"]["children"].count
      }
      // Row display. Implementers should *always* try to reuse cells by setting each cell's reuseIdentifier and querying for available reusable cells with dequeueReusableCellWithIdentifier:
      // Cell gets various attributes set automatically based on table (separators) and data source (accessory views, editing controls)
  
       func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -&gt; UITableViewCell
      {
  
          let cell = self.tableView?.dequeueReusableCellWithIdentifier("TitleCell",forIndexPath:indexPath) as UITableViewCell
          let row=indexPath.row
          print("got here /table view yeah")
  
          cell.textLabel?.text = manager.json["data"]["children"][row]["data"]["title"].stringValue
          cell.detailTextLabel?.text = manager.json["data"]["children"][row]["data"]["author_name"].stringValue
  
          /**if !json["data"]["children"][row]["data"]["thumbnail"].stringValue.isEmpty
          {
              let thumbnailPath=json["data"]["children"][row]["data"]["thumbnail"].stringValue
              let thumbnailURL:NSURL=NSURL(string: thumbnailPath)!
              let thumbnailData=NSData(contentsOfURL:thumbnailURL)
              let thumbnail=UIImage(data:thumbnailData!)
              cell.imageView?.image=thumbnail
          }**/
          return cell
      }
  
       func searchBarSearchButtonClicked(searchBar: UISearchBar) {
          manager.query="http://reddit.com/r/"+searchBar.text+"/.json"
          manager.data=NSMutableData()
  
          manager.startConnection()
          tableView?.reloadData()
      }
  
          /*
      // MARK: - Navigation
  
      // In a storyboard-based application, you will often want to do a little preparation before navigation
      override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
          // Get the new view controller using segue.destinationViewController.
          // Pass the selected object to the new view controller.
      }
      */
  
  }
  </code></pre>