Carousel in controller fiddling with dimensions in my collection view

I have a UICollectionView at the top of my view, as well as a ListView, when I click on a single ListView element, it opens a new controller with two (hidden / unclosed) bars at the top and bottom and a WebView in full screen mode with a carousel. I use tap or swipe normally, but after I close my new view (I have X on the top line), it shows the previous view, but suddenly the collection is smaller in height. ¿How can I prevent this?

I look around, and this is the same problem as, but the difference is that my problem is NOT a navigation bar - it is a collection under the navigation bar.

I have been doing this for hours, 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

In my first view, ListView one, a

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

I have an observer in a different view, this is a general view for my entire application, because it has a menu on the left and it changes the data on the right:

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

And the method of choice ....

 -(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; }]; 
+5
source share
1 answer

Finally, I am achieving this, and now this is no longer happening. This will only work if you do not need a navigation bar and you can customize your own bar. The way I do this DOES NOT create the top bar programmatically, I create it in the layout, and after that everything works correctly. I believe that the main problem was in the 2nd view, because it was a full-screen mode.

0
source

All Articles