templateによるpage-based applicationにPageControlを表示(SWIFT版)

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

ModelControllerに以下追加

[objc]
//
//————————————————————-
func presentationCountForPageViewController(pageViewController: UIPageViewController) -> Int
{
return self.pageData.count
}
func presentationIndexForPageViewController(pageViewController: UIPageViewController) -> Int
{
return 0
}
//————————————————————-
//
[/objc]

RootViewControllerを以下一部修正

[objc]
//
self.pageViewController = UIPageViewController(transitionStyle: .Scroll, navigationOrientation: .Horizontal, options: nil)
//
[/objc]

PageControlの色等変更については、AppDelegateに以下追加

[objc]
//
@implementation AppDelegate

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

//————————————————————-
let pageControl = UIPageControl.appearance()

pageControl.pageIndicatorTintColor = UIColor.lightGrayColor()

pageControl.currentPageIndicatorTintColor = UIColor.blackColor()

pageControl.backgroundColor = UIColor.whiteColor()
//————————————————————-

return YES;
}
//
[/objc]