user2844663
user2844663

Reputation:

UIPageViewController inside of a UITableViewCell

Hey I wanted to ask how do I implement a UIPageViewController inside of a UITableViewCell.

I have been reading around, but so far nothing seems to work for anyone trying.

I would appreciate some hints, no need for a full answer..

Thanks!.

Upvotes: 7

Views: 6177

Answers (1)

Léo Natan
Léo Natan

Reputation: 57040

It is unclear exactly what you are attempting to do, but let me see if I can explain. You want to have a page view controller view inside a table view cell.

You will need to create a page view controller per cell, resize its view to the size of the cell's content view and add the view as a subview of the cell. You will then have to implement the page view controller's datasource and delegate methods inside the cell.

Something like:

self.pageViewController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStyleScroll navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:nil];
[self.pageViewController setDataSouce:self];
[self.pageViewController setDelegate:self];
[self.pageViewController.view setFrame:self.contentView.bounds];
self.contentView addSubview:self.pageViewController.view];

However, this is a peculiar design, which looks over-complicated.

Upvotes: 6

Related Questions