点击头像单独把图片拉取出来.然后再次点击回到初始效果
2015-12-04 17:17
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;
}
相关文章推荐
- Echarts使用指南
- Php数组
- 从内存角度深入看结构体(window/linux)大小
- hdoj Calculate S(n) 2114 (数学规律 取余)
- C# 随机生成手机号码(中国地区)
- 广州的小伙伴福利-由微软组织的在广州SQL Server线下活动
- akka cluster make node as unreachable 问题
- react tab
- Xcode svn import项目 上传.a文件(静态库)
- EasyUI datagrid 获取全部数据
- Rose Study
- android 简单设置欢迎页面
- Python开发常用模块
- angular中compile和link的区别
- 【转】安装最新(较新)的node 和 npm
- 由于外键的存在引发的一个mysql问题 Cannot change column 'id': used in a foreign key constraint
- TextView来实现跑马灯的效果
- 点击导航栏tableView回到顶部
- NSData与UIImage之间的转换
- iOS-----后台运行