UIPageViewController」カテゴリーアーカイブ

PageViewControllerView下段にTOOLBAR表示

平成26年11月21日(金曜日)

  • storyboardにてTOOLBARを追加
  • TOOLBARのconstraints設定(左右と下 共に0)

[objc]
// 下段 TOOLBAR 有り
// Change the size of page view controller
self.pageViewController.view.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height – 40);
//
[/objc]

templateによるpage-based applicationにPageControlを表示

templateにより、page-based applicationを作成。

ModelController.mに以下追加
[objc]
//
– (NSInteger)presentationCountForPageViewController:(UIPageViewController *)pageViewController
{
return _pageData.count;
}

– (NSInteger)presentationIndexForPageViewController:(UIPageViewController *)pageViewController
{
return 0;
}
//
[/objc]

RootViewController.mを以下一部修正
[objc]
//
self.pageViewController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStyleScroll navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:nil];
//
[/objc]

PageControlの色等変更については、AppDelegate.mに以下追加
[objc]
//
@implementation AppDelegate

– (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.

UIPageControl *pageControl = [UIPageControl appearance];
pageControl.pageIndicatorTintColor = [UIColor lightGrayColor];
pageControl.currentPageIndicatorTintColor = [UIColor blackColor];
pageControl.backgroundColor = [UIColor whiteColor];

return YES;
}
//
[/objc]

UIPageViewController from scratch

How To Create UIPageViewController Using Storyboard

memo
page indicator

平成26年11月14日(金曜日)

  • Single View Application template  (root view controller)
  • product name PageViewDemo
  • Creating Page View Controller in Storyboard (Drag a Page View Controller from the Object Library) (page view controller)
  • add another View Controller (page content controller)
  • Storyboard ID PageViewController
  • Storyboard ID PageContentController
  • transition style to Scroll
  • page content controller image view and a label Drag add
  • root view controller Start again button add
  • Class create PageContentViewController custom class set
  • outlets for the image view and label
  • root view controller “Start again” button and name the action as “startWalkthrough”
  • Implementing the Page Content View Controller
  • Implementing the Page View Controller (container controller) (contain and manage multiple view controllers)
  • UIPageViewControllerDataSource protocol
  • Customize the Page Indicator (AppDelegate.m, add the following lines of code in the didFinishLaunchingWithOptions)