iphone - Trouble with tableview cell style - UITableViewCellStyleValue1 -
I am using table view to display a list. Only one cell will have UITableViewCellStyleValue1
. The problem is that while scrolling up / down, the expanded text is not displaying well here's the code.
// Customize the appearance of table view cells. - (UITableViewCell *) TableView: (UITableView *) Table View CellForOutPath: (NSIndexPath *) Index Pathway {Fixed NSString * CellIdentifier = @ "cell"; UITableViewCell * cell = [tableview] dequeueReusableCellWithIdentifier: CellIdentifier]; If (cell == blue) {if (indexPath.row == 0) {cell = [[[UTable view CL alloc] initWithStyle: UITableViewCellStyleValue1 reuseIdentifier: CellIdentifier] autorelease]; Cell.textLabel.textcolor = [UIColor whiteColor]; Cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton; Cell.detailTextLabel.textColor = [UIColor yellowColor]; Cell.detailTextLabel.text = @ "Details"; } Else {cell = [[[UITableViewCell alloc] initWithStyle: UITableViewCellStyleDefault reuseIdentifier: Cell Identifier] AutoExecution]; Cell.textLabel.textcolor = [UIColor whiteColor]; Cell.accessoryType = UITableViewCellAccessoryNone; }} // Configure cell.textLabel.text = [radio list objectOt Index: indexpath.ro]; Return cell; }
Can anyone help me?
You are not dealing with reusing the cell correctly. Instead try to do this and I think that you should be able to see what I am doing.
- (UITableViewCell *) Table view: (UITableView *) tableView cellForRowAtIndexPath: (NSIndexPath *) index path {UITableViewCell * cell = zero; If (indexPath.row == 0) {cell = [tableview decouwer reusable cell with identifier: cell identifier 2]; If (cell == blue) {cell = [[[UTableViewsell Alok] initWithStyle: UITableViewCellStyleValue1 reuseIdentifier: cell identifier 2] AutoWrecks]; } Cell.textLabel.textColor = [UIColor whiteColor]; Cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton; Cell.detailTextLabel.textColor = [UIColor yellowColor]; Cell.detailTextLabel.text = @ "Details"; } And {cell = [tableview dekwewer reusable cell with identifier: cell identifier]; If (cell == blue) {cell = [[[Uaitiblwugel light] initWithStyle: UITableViewCellStyleDefault reuseIdentifier: Selaidentifayr] Otorekg]; } Cell.textLabel.textColor = [UIColor whiteColor]; Cell.accessoryType = UITableViewCellAccessoryNone; }} // Configure cell.textLabel.text = [radio list objectOt Index: indexpath.ro]; Return cell; }
Comments
Post a Comment