开发者

UINavigationController with UIView and UITableView

I'm creating a navigation-based app which displays a graph, rendered with openGL, and a tableview listing disclosure buttons of all of the elements that are displayed on the graph, and a settings disclosure button.

The navigation controller is also a tableview delegate and datasource, and the tableview is added to the view programatically and has its' delegate and datasource set to 'self'. The OpenGL based graph view is added via IB.

The problem I'm having is that I'm trying to push a view controller (either settings or graph element properties) within the didSelectRowAtIndexPath method. The method registers and the new view is pushed on, but the tableview stays and obscures part of the view that was pushed on, as if it has a different navigation controller.

I can't seem to set the tableview's navigation controller to be the same as the rest of the UINavigationControllers' view.

Does anyone know how I could fix this?

My navigation controllers' initWithC开发者_如何学编程oder method, where the tableview is added, appears as follows:

elementList = [[UITableView alloc] initWithFrame:tableFrame style:UITableViewStyleGrouped];
elementList.dataSource = self;
elementList.delegate = self;
[self.view addSubview:elementList];

Further in the source file, the DidSelectRowAtIndexPath method where the navigation controller is pushed appears as follows:

Settings* Controller = [[Settings alloc] init];
[self pushViewController:Controller animated:YES];
[Controller release];


Fixed by just adding a UITableView in IB, adding IBOutlet to elementList, and setting the UIViewController as the delegate and datasource via IB.

Stack Overflow can be really useful for putting your problems to words so the solution becomes obvious.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜