UIViewTableCell didSelectRowAtIndexPath is calling but not pushing a view controller
Posted
by Kenneth
on Stack Overflow
See other posts from Stack Overflow
or by Kenneth
Published on 2010-06-09T08:49:00Z
Indexed on
2010/06/10
1:52 UTC
Read the original article
Hit count: 350
iphone-sdk
|ipad-sdk
Hi guys, so im having a UIViewController view with a UITableView. So the UIViewController class name is SelectionScreen. The UITableView class name is SelectionScreenTable.
Picture: http://img717.imageshack.us/i/screenshot20100609atpm0.png/
I have declared a UITableView *selectionTable in SelectionScreen class and connected it to the xib file of the SelectionScreen
what the problem is , is that when i click a row in the table,it stays selected as highlighted blue, it calls the didSelectRowAtIndexPath (checked with NSLog) but not pushing a new view which is called(GraphView).
This is the code which i use to call the new controller WHICH WORKS with a normal button
GraphView *aSelectionScreenViewController = [[GraphView alloc]
initWithNibName:@"GraphView"
bundle:nil];
[self presentModalViewController:aSelectionScreenViewController animated: YES]; [aSelectionScreenViewController release];
I searched around and found that I need to set a delegate for the table in the UITableView class itself on the viewload
tableview.delegate = self;
or
self.tableview.delegate = self;
But it was not working. the controller was still not being pushed, and yes i have checked the controller is not nil as i tried it with a simple button.
So i was thinking whether i should set the delegate of the UITableView at the UIViewController instead, so i tried this code
selectionTable.delegate = selectionTable.self;
but obviously it did not work =\, it messed up the whole UITableView and caused all the cells to be its predefined settings.
So does anybody have any idea on how i can get it to work.
© Stack Overflow or respective owner