我把UISplitViewControllers放在UITabBarController中。使用UISplitViewController的Tableview作为过滤器
我试图使用主视图作为过滤器。所以我用cellAccessoryType作为复选标记。只有一种可以选择。我写了这个代码是
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
self.selectedIndex = indexPath.row
let cell:UITableViewCell = self.tableView.cellForRowAtIndexPath(indexPath)!
cell.accessoryType = .Checkmark
self.performSegueWithIdentifier("dispAccounts", sender: self)
}
override func tableView(tableView: UITableView, didDeselectRowAtIndexPath indexPath: NSIndexPath) {
let cell:UITableViewCell = self.tableView.cellForRowAtIndexPath(indexPath)!
cell.accessoryType = .None
}
override func viewDidLoad() {
super.viewDidLoad()
filterList = ["All Accounts","Business Accounts","Person Accounts"]
self.tableView.allowsMultipleSelection = false
//self.splitViewController?.maximumPrimaryColumnWidth = 140; //This line is to restrict the width of master View of UISplitVC
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
// MARK: - Table view data source
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
// #warning Incomplete implementation, return the number of sections
return 1
}
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// #warning Incomplete implementation, return the number of rows
return 3
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("accountCell", forIndexPath: indexPath)
cell.textLabel?.text = filterList[indexPath.row]
return cell
}
现在一旦我选择“所有帐户”单元格,然后我移动到另一个选项卡“通话” 后来我复出“帐户”选项卡,然后我选择“企业会计'它正在被选中,复选标记也在更新,但问题是'所有帐户'单元格的复选标记没有消失。
您能否在'cellForRowAtIndexPath'中显示您使用的代码?另外,对于你的'UITableView',你是否启用了'allowMultipleSelection'?你想启用它吗? – Kumuluzz
已添加必需的密码@Kumuluzz 请看看。 不,我不想allowMultipleSelection。 即使我把它伪造同样的问题发生 –