On some apps, they have a little intro, that you can slide through different view controllers, that talk about it. For example: Evernote, etc. What's the name of this? And any good tutorial on how to do it?
No,There is no any ready made controller not available for introduction.You need to implement UIScrollView
and create your custom view and put into that scrollview
.
Following is the list of the different github demo projects for intro screen.
May this help lot,
Happy coding.
You can also use UIPageViewController.
1. Create an instance of UIPageViewController
self.pageViewController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStyleScroll
navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal
options:nil];
self.pageViewController.frame = self.view.bounds;
2. Implement its UIPageViewControllerDataSource protocol
self.pageViewController.dataSource = self;
....
- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController
viewControllerBeforeViewController:(UIViewController *)viewController
{
NSUInteger index = [(PageContentViewController *)viewController pageIndex]; // get any kind of index of the view controller to know its position
// here I subclass UIViewController to hold the index
if (index == 0) {
return nil;
}
// get the previous view controller
return self.pages[--index]; // container of all your pages
}
- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerAfterViewController:(UIViewController *)viewController {
// do the same as above but get the next view controller or nil if index >= [self.pages count]
}
- (NSInteger)presentationCountForPageViewController:(UIPageViewController *)pageViewController {
// how many items do we have
return [self.pages count];
}
- (NSInteger)presentationIndexForPageViewController:(UIPageViewController *)pageViewController {
// The selected item reflected in the page indicator.
return 0;
}
3. Create your pages.
self.pages = [[NSMutableArray alloc] init];
for (NSUInteger i=0; i<10; i++) { // 10 pages
PageContentViewController *page = [self.storyboard instantiateViewControllerWithIdentifier:@"PageContentViewController1"]; // you can also do it programmatically
// subclass of UIViewController just to hold its page index and for unified style purpose
page.pageIndex = i;
[self.pages addObject:page];
}
4. Display pages
NSArray *viewControllers = [NSArray arrayWithObject:self.pages[0]];
[self.pageViewController setViewControllers:viewControllers direction:UIPageViewControllerNavigationDirectionForward animated:NO completion:nil];
[self addChildViewController:self.pageViewController];
[self.view addSubview:self.pageViewController.view];
[self.pageViewController didMoveToParentViewController:self];
5. Dismiss
[self.pageViewController.view removeFromSuperview];
[self.pageViewController removeFromParentViewController];
Want to add some fancy animations when page view controller is shown?
CATransition *transition = [CATransition animation];
transition.duration = 0.4;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionPush;
transition.subtype = kCATransitionFromTop;
[self.pageViewController.view.layer addAnimation:transition forKey:kCATransition];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With