iphone開發之仿微信使用者引導介面的實現

來源:互聯網
上載者:User

出於使用者體驗大多數應用在應用初次開機時,顯示一個簡單的介紹頁面也就是使用者引導頁面,如下效果:   自己也試著嘗試了一下,主要是使用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的分類,將圖片分割成兩部分。 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.