Changing UIPageViewController's page programmatically doesn't update the UIPageControl

后端 未结 7 1713
悲哀的现实
悲哀的现实 2020-12-09 17:39

In my custom UIPageViewController class:

- (id)initWithCoder:(NSCoder *)aDecoder
{
    self = [super initWithCoder:aDecoder];
    if (self) {
           


        
7条回答
  •  有刺的猬
    2020-12-09 18:15

    Xamarin/C# Solution

    I had this problem in Xamarin, here is my version of @micromanc3r's solution:

    public class PageViewControllerDataSource : UIPageViewControllerDataSource
    {
        UIViewController[] pages;
    
        public PageViewControllerDataSource(UIViewController[] pages)
        {
            this.pages = pages;
        }
    

    ...

        public override nint GetPresentationIndex(UIPageViewController pageViewController)
        {
            return Array.IndexOf(pages, pageViewController.ViewControllers[0]);
        }
    }
    

提交回复
热议问题