点击头像单独把图片拉取出来.然后再次点击回到初始效果
2015-09-30 17:26
274 查看
长按保存效果未做
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;
}
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;
}
相关文章推荐
- html 不常用的标签
- SQL UNION 和 UNION ALL的区别
- 验证码的生成
- Redis与Memcached比较
- SSH原理
- 深入理解c++构造函数, 复制构造函数和赋值函数重载(operator=)
- hdu 1542(扫描线)
- hive on spark 编译
- IOS 3Dtouch
- android 文件上传
- 逻辑问题
- 获取指定格式时间戳(JSON注入)
- Quartz2D绘图<三>绘制图形
- iOS 9适配技巧(更新版)
- iOS开发之 转场动画CATransition
- shell——html抓取链接
- [转载]Shell正则表达式
- 关于iOS的自动弹出键盘问题
- 为UITextView添加通知..来检测UITextView内容的改变
- 自定义tabbar切换视图