iosxcodealignmentcenterpagecontrol

How to make a view appear first when the app loads up, out of 3 views - IOS


I'm working on an IOS app. It has 3 screens(views) that'l appear in a dotted page when the app loads up. What's happening is when the app finishes loading, it'l directly start displaying at screen 1. But i want it to start at screen 2 (center screen). How can i do this? A link towards working example will be a great help.

Thanks


Solution

  • If you're using a UIPageControl, set the currentPage = 1. Your UIControlEventValueChanged responder will handle the page change.

    UIPageControl *myPageControl = [[UIPageControl alloc] init];
    [myPageControl addTarget:self action:@selector(pageChanged:) forState:UIControlEventValueChanged];
    [myPageControl setCurrentPage:1];