MWPhotoBrowser into Tabbar Controller

462 views Asked by At

I use MWPhotoBrowser to make an image Gallery. If i make a new controller(push) all work fine. Although i want to add MWPhotoBrowser into a custom ViewController which is into a TabBarController. I got this with these lines of code.

[self addChildViewController:browser];

[[self view] addSubview:[browser view]];

[browser didMoveToParentViewController:self];

The problem is that when i change the orientation(rotate the device) only a part of screen works. The rest seems to be dead.I suppose that my view keeps previous frame bounds but i don't know how to change this.

I tried setFrame to self.browser.view but it didn't work.

The strange is that if i change tab and come back to photos tab all again work properly.

1

There are 1 answers

0
hoya21 On BEST ANSWER

If anyone has the same issue in future this line solved my problem. Maybe it was my mistake that i had forgotten this.So i had to add this line to my viewDidLoad method.

self.view.autoresizingMask= UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;