你好,歡迎來到IOS教程網

 Ios教程網 >> IOS編程開發 >> IOS開發綜合 >> iphone開發之仿微信用戶引導界面的實現

iphone開發之仿微信用戶引導界面的實現

編輯:IOS開發綜合
出於用戶體驗大多數應用在應用首次啟動時,顯示一個簡單的介紹頁面也就是用戶引導頁面,如下效果:     \   自己也試著嘗試了一下,主要是使用scrollview實現視圖的切換,當切換到最後一張時會出現一個開始按鈕,點擊開始按鈕關閉引導。   開始按鈕點擊處理:     [cpp]  - (IBAction)startButtonDidPressed:(id)sender{       [self.startButton setHidden:YES];       NSArray *array = [UIImage splitImageIntoTwoParts:self.imageView.image];       self.left = [[UIImageView alloc] initWithImage:[array objectAtIndex:0]];       float height = DEVICE_IS_IPHONE5 ? 568 : 480;       [self.left setFrame:CGRectMake(0, 0, 320, height)];       self.right = [[UIImageView alloc] initWithImage:[array objectAtIndex:1]];       [self.right setFrame:CGRectMake(0, 0, 320, height)];              [self addSubview:self.left];       [self addSubview:self.right];       [self.pageScroll setHidden:YES];       [self.pageControl setHidden:YES];       self.left.transform = CGAffineTransformIdentity;       self.right.transform = CGAffineTransformIdentity;              [UIView beginAnimations:@"split" context:nil];       [UIView setAnimationDelegate:self];       [UIView setAnimationDuration:1.2];       [UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)];              [self.left setAlpha:0.15];       [self.right setAlpha:0.15];       self.left.transform = CGAffineTransformMakeTranslation(-180 ,0);       self.right.transform = CGAffineTransformMakeTranslation(180 ,0);          [UIView commitAnimations];   }     - (IBAction)startButtonDidPressed:(id)sender{     [self.startButton setHidden:YES];     NSArray *array = [UIImage splitImageIntoTwoParts:self.imageView.image];     self.left = [[UIImageView alloc] initWithImage:[array objectAtIndex:0]];     float height = DEVICE_IS_IPHONE5 ? 568 : 480;     [self.left setFrame:CGRectMake(0, 0, 320, height)];     self.right = [[UIImageView alloc] initWithImage:[array objectAtIndex:1]];     [self.right setFrame:CGRectMake(0, 0, 320, height)];          [self addSubview:self.left];     [self addSubview:self.right];     [self.pageScroll setHidden:YES];     [self.pageControl setHidden:YES];     self.left.transform = CGAffineTransformIdentity;     self.right.transform = CGAffineTransformIdentity;          [UIView beginAnimations:@"split" context:nil];     [UIView setAnimationDelegate:self];     [UIView setAnimationDuration:1.2];     [UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)];          [self.left setAlpha:0.15];     [self.right setAlpha:0.15];     self.left.transform = CGAffineTransformMakeTranslation(-180 ,0);     self.right.transform = CGAffineTransformMakeTranslation(180 ,0);        [UIView commitAnimations]; }         將最後一張圖片切割成兩部分,添加一個“開門的動畫”,動畫結束時移除圖片:     [cpp]  -(void)animationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context   {          [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone];       if ([animationID isEqualToString:@"split"] && finished) {           [self.left removeFromSuperview];           [self.right removeFromSuperview];       }       [self removeFromSuperview];   }     -(void)animationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context {        [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone];     if ([animationID isEqualToString:@"split"] && finished) {         [self.left removeFromSuperview];         [self.right removeFromSuperview];     }     [self removeFromSuperview]; }       說明:splitImageIntoTwoParts (Terry Lin 實現)是實現了UIImage的分類,將圖片分割成兩部分。  
  1. 上一頁:
  2. 下一頁:
蘋果刷機越獄教程| IOS教程問題解答| IOS技巧綜合| IOS7技巧| IOS8教程
Copyright © Ios教程網 All Rights Reserved