0

In my app I nearly have 10 tab items which end up adding a more button to the tab bar. When I select the more button it list the other tab bar contents as a list. I select one of them and navigate inside (this has a navigation controller) and click on an item. Again if I click on the more button the previous page loads and to load the more tab items I have to click several times as it will pop the UI controllers. Hence I need to load the tab bar list every time the user click on more item. Please help me to figure it out how to do it.

Thank you

Dilshan
  • 3,231
  • 4
  • 39
  • 50

3 Answers3

0

You can do this by in the ViewWillDisappear method of view controller in More tab, call method to pop this view out of MoreViewNavigationController, like this:

[super viewWillDisappear:animated];

[self.navigationController popViewControllerAnimated:NO];

this is the answer

Community
  • 1
  • 1
m e
  • 47
  • 1
  • 6
0

If you need a lot of buttons on the bar button item is and they do not fit into it.

//  MasterViewController.h
        .
        .
        .

        - (IBAction)btMy:(id)sender;
        @property (weak, nonatomic) IBOutlet UIBarButtonItem *btMy;


        @property (weak, nonatomic) IBOutlet UIBarButtonItem *bt1;
        @property (weak, nonatomic) IBOutlet UIBarButtonItem *bt2;
        @property (weak, nonatomic) IBOutlet UIBarButtonItem *bt3;
        @property (weak, nonatomic) IBOutlet UIBarButtonItem *bt4;
        @property (weak, nonatomic) IBOutlet UIBarButtonItem *bt5;
        @property (weak, nonatomic) IBOutlet UIBarButtonItem *bt6;
        @property (weak, nonatomic) IBOutlet UIBarButtonItem *bt7;
        @property (weak, nonatomic) IBOutlet UIBarButtonItem *bt8;
        @property (weak, nonatomic) IBOutlet UIBarButtonItem *fl1;
        @property (weak, nonatomic) IBOutlet UIBarButtonItem *fl2;
        @property (weak, nonatomic) IBOutlet UIBarButtonItem *fl3;
        @property (weak, nonatomic) IBOutlet UIBarButtonItem *fl4;
        @property (weak, nonatomic) IBOutlet UIBarButtonItem *fl5;
        @property (weak, nonatomic) IBOutlet UIBarButtonItem *fl6;
        @property (weak, nonatomic) IBOutlet UIBarButtonItem *fl7;
        @property (weak, nonatomic) IBOutlet UIBarButtonItem *fl8;
        @end

        //  MasterViewController.m
        .
        .
        .
    @interface MasterViewController ()
    { 
        BOOL tt;
    }
    .
    .
    .
       - (IBAction)btMy:(id)sender {
        [self nextToolBar];

    } 

        -(void) nextToolBar {
         if (tt ) {
                self.navigationController.toolbar.items = [NSArray arrayWithObjects:_bt1, _fl1, _bt2, _fl1, _bt3, _fl1, _bt4, _fl1, _btMy, nil];
                tt = NO;
            }else{
                self.navigationController.toolbar.items = [NSArray arrayWithObjects:  _bt5, _fl1, _bt6,_fl1,_bt7,_fl1, _bt8, _fl1, _btMy, nil];
                tt = YES;
                 }

            for ( NSInteger x = 0; x < 8; x++){ // если при перевороте цвет меняли на прозрачный, востанавливаем обратно

                [self.navigationController.toolbar.items[x] setTintColor:_btMy.tintColor];
            }

        }

        -(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{ // после смены орентации устройства
           [self nextToolBar]; // показываем кнопки 4+1 иначе отображается все кнопки 8+1 шт

        }

        -(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)orientation duration:(NSTimeInterval)duration{ // до смены арентауции устройства
            NSArray *myArray = [NSArray arrayWithObjects:_bt1, _bt2, _bt3, _bt4, _bt5, _bt6, _bt7, _bt8, nil]; // перед переворотом экрана меняем цвет на прозрачный
            for ( NSInteger x = 0; x < 8; x++){

                [myArray[x] setTintColor:[UIColor clearColor]];  //  
                 }
            if (tt) {tt=NO;} else {tt=YES;}   // чтобы вернуться на тот же набор кнопок
        }
Oleg
  • 1
  • 2
0

Maybe you should think about restructuring your app. Do you really need 10 parallels area of information/functionality?!

Paul Ardeleanu
  • 6,620
  • 2
  • 40
  • 41