首页 > 其他 > 详细

Day6

时间:2015-03-23 21:24:36      阅读:256      评论:0      收藏:0      [点我收藏+]

1 改变状态栏(手机屏幕最上面的状态栏,电池时间那个栏目)

/** modify status bar */
-(UIStatusBarStyle)preferredStatusBarStyle{
    return UIStatusBarStyleLightContent;
}

2 增加蒙板的写法

/** 大图*/
- (IBAction)bigImage {
    //增加蒙板
    //将图片移动到视图的顶层
    //计算图片的目标位置,动画显示
    UIButton *button = [[UIButton alloc]initWithFrame:self.view.bounds];
    button.alpha = 0.5f;
    button.backgroundColor = [UIColor blackColor];
    [self.view addSubview:button];
    
    //将视图拿到顶层
    [self.view bringSubviewToFront:self.iconView];
    
    //先计算目标位置
    CGFloat viewW = self.view.bounds.size.width;
    CGFloat imageW = viewW;
    CGFloat imageH = imageW;
    CGFloat imageY = (self.view.bounds.size.height-imageH)*0.5;
//    [UIView beginAnimations:nil context:nil];
//    [UIView setAnimationDuration:2.0f];
//    self.iconView.frame = CGRectMake(0, imageY, imageW, imageH);
//    [UIView commitAnimations];
    
    [UIView animateWithDuration:1.0f animations:^{
        self.iconView.frame = CGRectMake(0, imageY, imageW, imageH);
    } completion:^(BOOL finished) {
        //
    }];
}

3 拦截首尾式动画结束的方法

-(void)smallImage{
    //动画变小
//    [UIView animateWithDuration:1.0f animations:^{
//        self.iconView.frame = CGRectMake(85, 135, 150, 150);
//
//    } completion:^(BOOL finished) {
//        [self.cover removeFromSuperview];
//    }];
    
    //拦截首尾式动画结束的方法
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:1.0f];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationDidStopSelector:@selector(removeCover)];
    self.iconView.frame = CGRectMake(85, 135, 150, 150);
    [UIView commitAnimations];
    
    //隐藏遮罩
    
}

-(void)removeCover{
    [self.cover removeFromSuperview];
}

  

Day6

原文:http://www.cnblogs.com/lihaozhou/p/4360931.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!