あらかじめ用意した画像とメッセージを登録するだけで、ウォークスルーパターンを実現できる。
あらかじめ用意しておいたページを指でめくっていける。
専用のViewControllerが用意されていて、ページ設定を行った後に現在のViewControllerへ追加するだけで良い。
// Create the walkthrough view controller LAWalkthroughViewController *walkthrough = LAWalkthroughViewController.new; walkthrough.view.frame = self.view.frame; walkthrough.backgroundImage = [UIImage imageNamed:@"tour-bg@2x"]; // Create pages of the walkthrough [walkthrough addPageWithBody:@"Take a tour of this app."]; [walkthrough addPageWithBody:@"Thanks for taking this tour."]; // Use the default next button walkthrough.nextButtonText = nil; // Add the walkthrough view to your view controller's view [self addChildViewController:walkthrough]; [self.view addSubview:walkthrough.view];
Xib名を指定して直接読むこむことができる。
// Create the walkthrough view controller LAWalkthroughViewController *walkthrough = LAWalkthroughViewController.new; walkthrough.view.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height-50); walkthrough.backgroundImage = [UIImage imageNamed:@"tour-bg1@2x"]; // Create pages of the walkthrough from XIBs [walkthrough addPageWithNibName:@"TourView1" bundle:nil]; // no need for a view controller [walkthrough addPageWithNibName:@"TourView2" bundle:nil]; // no need for a view controller [walkthrough addPageWithNibName:@"TourView3" bundle:nil]; // no need for a view controller // Use text for the next button walkthrough.nextButtonText = @"Next >"; // Add the walkthrough view to your view controller's view [self addChildViewController:walkthrough]; [self.view addSubview:walkthrough.view];
この簡単さは魅力的。使ってみたい。
0 件のコメント:
コメントを投稿