I have a Cell with lots of Labels and a Button.
I want to make cell's color blue and make only the button selectable, not the cell.
The button should have its own color.
How can I do this using with xCode and the IPhone SDK?
I have a Cell with lots of Labels and a Button.
I want to make cell's color blue and make only the button selectable, not the cell.
The button should have its own color.
How can I do this using with xCode and the IPhone SDK?
implement the following method in your UITableViewController:
- (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath
Then return nil for any cell that you do not want selectable (Your cells with buttons). You can get additionaly explanation from the UITableViewDelegate protocol reference.
From the UItableViewDelegate protocol reference:
-(NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath
Parameters tableView A table-view object informing the delegate about the impending selection.
indexPath An index path locating the row in tableView.
Return Value An index-path object that confirms or alters the selected row. Return an NSIndexPath object other than indexPath if you want another cell to be selected. Return nil if you don't want the row selected.
Discussion This method is not called until users touch a row and then lift their finger; the row isn't selected until then, although it is highlighted on touch-down. You can use UITableViewCellSelectionStyleNone to disable the appearance of the cell highlight on touch-down.