5

I have a UICollectionView on the top of my view and also a ListView, when I click on one item of the ListView it opens a new controller with two (hidden/unhidden) bars at the top and bottom and a WebView in fullscreen with Carousel. I use tap or swipe normally but after I close my new View (I have a X in the top bar) it shows the previous view but suddenly the Collection size is smaller in height. ¿How do I prevent this?

I've been looking around and it is the same problem like this but the difference that my problem is NOT the NavigationBar, is the Collection beneath the NavigationBar.

I've been hours with this and I need someone to point me in some direction.

EDIT enter image description here

enter image description here

enter image description here

EDIT - UPDATE

I have in my first view the ListView one, a

[[NSNotificationCenter defaultCenter] postNotificationName: showFooMode....

I do have an observer in another view, it is the common view for my whole app because it have the menu in the left and it changes the data in the right:

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(showfooMode:) name:@"showFooMode" object:nil];

And the selector method....

-(void)showfooMode:(NSNotification *)notification{
    NSLog(@"Show fooView in the GeneralView);
        FooItem *foo = [notification.object objectForKey:@"foo"];
        NSInteger currentIndex = [[notification.object objectForKey:@"foo"] integerValue];

        auxFooView = [notification.object objectForKey:@"delegate"];
      //  currentIndex = 20;

        fooView = [self.storyboard instantiateViewControllerWithIdentifier:@"fooView"];
        [fooView setNews:news];
        [fooView setDelegate:self];
        [fooView setCurrentIndex:currentIndex];
        fooView.view.alpha = 0;



        [self.view addSubview: magazineVC.view];
        [self addChildViewController:fooView];


        fooView.view.translatesAutoresizingMaskIntoConstraints = NO;

        NSDictionary *views = @{@"childview": fooView.view};
        [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"|-0-[childview]-0-|" options:0 metrics:nil views:views]];
        [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-0-[childview]-0-|" options:0 metrics:nil views:views]];
        [self.view layoutIfNeeded];

        [UIView animateWithDuration:0.3 animations:^{
            fooView.view.alpha = 1;
        }];
Community
  • 1
  • 1
ZetaPR
  • 964
  • 7
  • 32

1 Answers1

0

Finally, I achieve it, and now this is not happening any more. This will work only if you don't need the navigation bar, and can set your own custom bar. The way I do this is NOT creating the top bar programmatically I create it in the layout and after that everything was working correctly. I asume that the main problem was in the 2nd View because it was a full-screen mode.

ZetaPR
  • 964
  • 7
  • 32