Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using UIPageViewController in a UIView

I'm trying to create a book reading application on IOS/Xcode4.6 and I created a UIPageViewController. The application is for iPads and it'll always be on landscape mode, so I'm displaying two UIViewControllers at once.

all working fine, but i need to reduce the size of the book as it takes the full screen to display the pages. When i try to resize the view, the content of the UIViewControllers represented as book pages goes out of the book.

This is what i need the interface to look like. Please help. thanks in advance.

How the interface looks like

like image 255
melaka Avatar asked May 01 '26 00:05

melaka


1 Answers

Phew, found the solution after few search cycles. It may not be the best way of doing it but then here's what I did, pretty simple.

I set my pages' (UIViewControllers) view with an autoresizing mask inside init;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        self.view.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
    }

return self;
}
like image 67
melaka Avatar answered May 02 '26 15:05

melaka



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!