views:

436

answers:

1

Hi

I want to personalize my UITableView changing background when user tap on a specific cell. I've a dedicated ViewController for each cell and if I implement touchesBegan method in this viewController i can change my cell background without any problem. The problem is that the method "didSelectRowAtIndexPath" of the UITableView is no longer called. How can I call it manually? I am in another viewController and I have no access to that method. or how can propagate to the touch tableView? Thanks a lot

+1  A: 
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
        //do your operations

        //send it to super class
    [super touchesBegan:touch withEvent:event];

}

[super touchesBegan:touch withEvent:event]; Are you sending your action to super class? If not then add this line.

Manjunath
I tried but don't solve the problem
Luca
Where did you implemented this touch event?In controller class or in cell?
Manjunath
I've a UITableViewController (called TableViewController) that alloc and "use" a UIViewController (called CellViewController). I need to intercept touch on CellViewController with touchesBegan and TouchesEnd (and this work well) but also with [super touchesBegan:touches withEvent:event] the touch event is not propagated to TebleViewController and the method didSelectRowAtIndexPath is not called.
Luca
Yes you are right. "didSelectRowAtIndexPath" will not get called if you implemented touch event in a view controller. You handle the touchesBegan and TouchesEnd events in cell class i.e., UITableViewCell. After performing your operations send that actions to super class. This will work for you.
Manjunath
Yes, but i need to call the didSelectRowAtIndexPath method. there is no way they are called? I've send the touchevent to the superclass but the method is not called.
Luca
please post your code so that I can get to know what is your problem. I am asking you to implement the touch events in UITableviewCell not in UITableviewController class or in any other UIViewController Classes. You will be displaying the Cell in table view right? In that Cell class implement the Touches event methods.didSelectRowAtIndexPath method will get called automatically.
Manjunath
Update:The situation is different:My cell Layou is not a tableView cell but a simple UIViewThis change anything? I've a UIView and a UIViewController and the UITableViewController.
Luca