Scroll up when you press the status bar

I have a view controller (it is called MainViewContoller), in which 3 different tables are presented (one at a time), the user can click a segment control to switch between these tables.

To present these 3 tables, it MainViewContollerhas 3 other view controllers (A, B and C), each of them has UITableViewas a spy and processes its own data.
When loaded MainViewContoller, it starts controllers A, B, and C and adds its View tables to them:

- (void)viewDidLoad {
    [super viewDidLoad];

    ViewControllerA *vcA = [ViewControllerA alloc] init];
    [self.view addSubview:vcA.view];

    ViewControllerB *vcB = [ViewControllerB alloc] init];
    [self.view addSubview:vcB.view];

    ViewControllerC *vcC = [ViewControllerC alloc] init];
    [self.view addSubview:vcC.view];
}

So, for example, when a user clicks on a segment control and selects A, MainViewContollerhides tables B and C and displays table A. Something like this:

if (userTapOnA) {
    self.viewControllerA.tableView.hidden = NO;
    self.viewControllerB.tableView.hidden = YES;
    self.viewControllerC.tableView.hidden = YES;
}  

Problem:

, , .
, , , , .
, , MainViewContoller, , MainViewContoller .

- , ?

+5
2

UIScrollView:

/* , , , , scrollsToTop YES, NO shouldScrollViewScrollToTop, . iPhone , scrollsToTop == YES. , . */

@property (nonatomic) BOOL scrollsToTop;// - YES.

, scrollsToTop NO, , .

+26

.

[self addChildViewController:vcA];
[self addChildViewController:vcB];
[self addChildViewController:vcC];

, , .

+2

All Articles