views:

86

answers:

2

Hello all, I created a very simple view trying to combine a navigation controller and table view together:

.h

interface FileView : UIView {
    UINavigationController * _nav;
    UITableViewController * _tableView;
}

.m

- (id)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        _tableView = [[FileTableViewController alloc] initWithStyle:UITableViewStyleGrouped];
        _nav = [[UINavigationController alloc]initWithRootViewController:_tableView];
        [self addSubview:_nav.view];  
    }
    return self;
}

Then, to my surprise, when I added this view into the main window. I found the tableview simply didn't scroll, and table cells didn't respond to any events. It looked like the table view was hidden't under some glass.

Anyone knows how to solve the issue? and what step I missed to make it work?

Thanks a lot!

A: 

Try adding this line after adding the subview:

[self bringSubviewToFront:_nav.view]; 
pheelicks
A: 

Thanks, Problem solved. When creating the FileView, I need to provide a Frame, which I didn't :)

sprinter