Sunday, 15 May 2011

ios - How to hide content on specific cells only, despite using dequeueReusableCell? -


When we cross a specific number of lines, I would like to hide some elements in a custom cell I've added more rows than compared, because I need to scroll to the last line without bouncing effect. But now I have more cells, and after the rows I do not need cells> 13.

If I tried to set up sleep, show the cell with someone else but dequeue ... The effect of the method is the cells, when I scroll up, goes into the previous cells, then they do not have any texts like rows now> 13. Is there a way to use a dequeue method, and for the rows Give to the lien & lt; 13, and remove the content for the rows> 13?

Here are some code:

  function table view (table view: UITableView, cellularoattexpath indexpath: NSIndexpath) - & gt; UITableViewCell {var identifier = "" If tableView == self.tableView {identifier = "MyCell" cell = tableView.dequeueReusableCellWithIdentifier (identifier) ​​as myCell if indexPath.row & lt; 14 {cell.showContent = true cell.label.text = "test \ (indexPath.row)"} other {cell.showContent = false cell.label.text = "cell.addItem.text =" cell.setNeedsDisplay ( ) Return Cell} // Maiseel Override Funk Dracret (Rectunt: CGRact) {if! Show content {label.text = "" ed itam. Text = ""} and {path = UIBezierPath () // custom separator that should not be row & gt; 13  

thanks

You do not modify the text Should do the drawRect method. You have already modified the label in cellphone. You just need it.

He said, it is not like how I will do it. I would probably create a separate room for empty cells with their own identifier. In this way they can be really simple and you do not have to get rid of things like cell.setNeedsDisplay () from the separator line. So in Cellophora, just return a type of cell for data rows and a different cell for blank rows. There is no rule that says that all cells should be of the same class.


No comments:

Post a Comment