zoukankan      html  css  js  c++  java
  • 点击头像单独把图片拉取出来.然后再次点击回到初始效果

    长按保存效果未做
     
    CGRect frame_first;
        UIImageView *fullImageView;
        UIImageView *photoImage;
     
    - (void)imageTap:(UITapGestureRecognizer *)sender {
       
        CGPoint location = [sender locationInView:self.tableView];
       
        NSIndexPath *indexPath  = [self.tableView indexPathForRowAtPoint:location];
       
        UITableViewCell *cell = (UITableViewCell *)[self.tableView  cellForRowAtIndexPath:indexPath];
       
        UIImageView *imageV = (UIImageView *)[cell.contentView viewWithTag:9999];
       
        frame_first = CGRectMake(cell.frame.origin.x + imageV.frame.origin.x, cell.frame.origin.y + imageV.frame.origin.y - self.tableView.contentOffset.y, imageV.frame.size.width, imageV.frame.size.height);
       
        fullImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];
        fullImageView.backgroundColor=[UIColor blackColor];
        fullImageView.userInteractionEnabled=YES;
        [fullImageView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(actionTap2:)]];
        fullImageView.contentMode=UIViewContentModeScaleAspectFit;
        photoImage = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 84, 84)];
        NSDictionary *userPhoDic = [_dataHandle getLocalData:USERIMAGE];
        NSData *da = [userPhoDic objectForKey:@"image"];
        photoImage.image = [UIImage imageWithData:da];
        [fullImageView addSubview:photoImage];
        if (![fullImageView superview]) {
            [self.view.window addSubview:fullImageView];
            fullImageView.frame = frame_first;
            [UIView animateWithDuration:0.5 animations:^{
                fullImageView.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
                photoImage.frame = CGRectMake((SCREEN_WIDTH - 54) / 2, (SCREEN_HEIGHT - 54) / 2, 84, 84);
            } completion:^(BOOL finished) {
                [UIApplication sharedApplication].statusBarHidden=YES;
            }];
        }
    }

    -(void)actionTap2:(UITapGestureRecognizer *)sender{
       
        [UIView animateWithDuration:0.5 animations:^{
            fullImageView.frame = frame_first;
            photoImage.frame = CGRectMake(0, 0, 54, 54);
        } completion:^(BOOL finished) {
            [fullImageView removeFromSuperview];
        }];
        [UIApplication sharedApplication].statusBarHidden = NO;
    }
  • 相关阅读:
    用Darwin和live555实现的直播框架
    用Darwin和live555实现的直播框架
    VS2010 C++编译报错LINK : fatal error LNK1123: 转换到 COFF 期间失败: 文件无效或损坏
    VS2010编译和运行项目错误
    C#如何使用VS2010与SQL2008建立链接及初步调用(转)
    linQ to sql 查询生成的sql语句
    查看Linq to Sql生成的sql语句(转)
    linq to sql 项目移植后,数据库实体类需要重新创建?
    什么是Asp.net Core?和 .net core有什么区别?(转)
    ASP.NET Core 2.0 使用支付宝PC网站支付实现代码(转)
  • 原文地址:https://www.cnblogs.com/tian-sun/p/4849751.html
Copyright © 2011-2022 走看看