iphone development: using tableview cells as a button

Is that possible to use tableView cells like a button? In my app I want to have a table view which has 4 rows and in each row there will be labels. What I want is when I touch a row, the table tableview cell should react like a button (perform an action and background is highlighted)? Is that possible? How can I do that? Thanks.

Answers


very simple the delegate method will be called didSelectRowAtIndexPath there you can get which row is tapped in which section and you can perform further action.

for example

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    // deselect
    [tableView deselectRowAtIndexPath:indexPath animated:YES];

    if(indexPath.row == 0){
        LoginFormViewController *vController = nil;
        if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
        {
            vController = [[LoginFormViewController alloc] initWithNibName:@"LoginFormViewController_ipad" bundle:nil];
        }else {
            vController = [[LoginFormViewController alloc] initWithNibName:@"LoginFormViewController" bundle:nil];
        }
        [self.navigationController pushViewController:vController animated:YES];
        [vController release];
    }
}

Need Your Help

python - Nose not discovering package level tests in Django

python django nose django-nose

I'm setting up a directory structure for my Django app to separate functional and unit tests. I am using nose as the test runner for my Django project.

Alternative to dompdf (PHP Tool To Cnvert HTML+CSS To PDF) But in .NET?

.net php html pdf dompdf

From their site (Free Project On Google Code): http://code.google.com/p/dompdf/