我的TabBarController中的第二个TableView Cell消失

时间:2015-10-03 20:34:08

标签: ios swift uitableview uitabbarcontroller tabbar

我有一个TabBar基础应用程序(使用Swift),我在不同的ViewControllers中获得了2个表视图,只有第一个视图中的表,但不在其他视图中。 我检查细胞的显示,没问题。 如果我放置另一个视图(没有表作为第一个视图),表视图中的其他视图也不会出现。

我的问题的一些图片

http://s12.postimg.org/7c58vxfe5/Captura_de_pantalla_2015_10_03_a_las_17_25_01.png

http://s13.postimg.org/meysu5j0n/Captura_de_pantalla_2015_10_03_a_las_17_24_48.png

提前致谢!

编辑: 一些代码

import UIKit

class HomeViewController: UIViewController , UITableViewDataSource , UITableViewDelegate , UITabBarControllerDelegate {
let CellIdentifier = "CellTarea";
@IBOutlet var tareasTable: UITableView!
let tareas = ["Revisar etiquetado leche Nido","Reponer yoghurt sin lactosa","Reponer Chocolates Sahne Nuss","Revisar etiquetado de Chamito","Reponer Nescafe Clasico 200 gr."]
override func viewDidLoad() {
    super.viewDidLoad()
    self.tareasTable.delegate=self
    self.tareasTable.dataSource=self
    //Tabbar Config
    self.tabBarController?.delegate = self;
    for item in (self.tabBarController?.tabBar.items as NSArray!){
        (item as! UITabBarItem).image = (item as! UITabBarItem).image?.imageWithRenderingMode(.AlwaysOriginal)
        (item as! UITabBarItem).selectedImage = (item as! UITabBarItem).selectedImage?.imageWithRenderingMode(.AlwaysOriginal)
    }
    // Do any additional setup after loading the view.
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}
//MARK: - TableView
func numberOfSectionsInTableView(tableView: UITableView) -> Int {
    return 1
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    return 5
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
    let cell:CustomTareasCell = tableView.dequeueReusableCellWithIdentifier(CellIdentifier, forIndexPath: indexPath) as! CustomTareasCell
    cell.tareaLabel.text = tareas[indexPath.row];
    cell.indiceLabel.text = String(indexPath.row+1);
    return cell
}

其他具有tableview的视图控制器

import UIKit

class ReportesViewController: UIViewController, UITableViewDelegate , UITableViewDataSource, UITabBarControllerDelegate {
 let personas = ["Alexis Parra","Ernesto Jímenez","Paulina Torres","Juan Soto","Julio Gallardo"]
let fechas = ["24 de Septimbre","22 de Septimbre", "21 de Septimbre", "20 de Septimbre","18 de Septimbre"]
let textCellIdentifier = "CellReporte";

@IBOutlet var reportesTable: UITableView!
override func viewDidLoad() {
    super.viewDidLoad()
    self.reportesTable.delegate=self;
    self.reportesTable.dataSource=self;
    // Do any additional setup after loading the view.
}

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

override func viewDidAppear(animated: Bool) {
    let topOffest = CGPointMake(0, -(self.reportesTable.contentInset.top))
    self.reportesTable.contentOffset = topOffest
}

//MARK: - TableView
func numberOfSectionsInTableView(tableView: UITableView) -> Int {
    return 1
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    return 5
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
    let reportesCell:CustomReportesCell = tableView.dequeueReusableCellWithIdentifier(textCellIdentifier, forIndexPath: indexPath) as! CustomReportesCell
    print(fechas[indexPath.row])
    reportesCell.fecha.text = fechas[indexPath.row];
    reportesCell.autor.text = personas[indexPath.row];
    return reportesCell
}

0 个答案:

没有答案
相关问题