有一个UITableView
有许多照片。在拍摄照片时,modalView
与UIScrollView
一起呈现,其中还嵌入有UIImageView
。点击图片在这里展示(类似Facebook应用程序)。 现在,我可以使用touchesMoved
和CGRectMake
垂直移动图像。 我想要实现的是,当我上下拖动图像,在达到一定的阈值时,ImageView的&滚动型应该会消失,我们应该回到的tableView。基于触摸上嵌入的UIScrollView
- (void) touchesMoved:(NSSet *)touches
withEvent:(UIEvent *)event {
UITouch * touch = [touches anyObject];
CGPoint pos = [touch locationInView: [UIApplication sharedApplication].keyWindow];
NSLog(@"%f", pos.y);
if (pos.y>50&&pos.y<430){
[UIView setAnimationDelay:0];
[UIView animateWithDuration:0.4
animations:^{_photoImageView.frame=CGRectMake(0,pos.y-100,320,200);}
completion:^(BOOL finished){ }];
}
}
动作将控制返回给所述的tableView这里需要:
图片使用移动
- (void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch * touch = [touches anyObject];
CGPoint pos = [touch locationInView: [UIApplication sharedApplication].keyWindow];
if (pos.y>50&&pos.y<430){
[UIView setAnimationDelay:0];
[UIView animateWithDuration:0.4
animations:^{_photoImageView.frame=CGRectMake(0,140,320,200);}
completion:^(BOOL finished){ }];
}
else if(pos.y<50||pos.y>430)
//Code needed here !!
;
}
此外,如果透明性可以在imageView
背景(即,滚动型)来实现这样的该表视图是可见的某些阿尔法,这将不胜感激。
要补充的UIView或UIViewController中 – 2013-04-30 07:57:11
这是一个UIView。 – n00bProgrammer 2013-04-30 08:05:13
[查看removeFromSuperView];你没有尝试这个视图是你的滚动视图 – 2013-04-30 08:07:43