【发布时间】:2011-09-16 20:47:57
【问题描述】:
实际上,我想将数据从一个视图推送到另一个视图。我有一个 UIScrollView,上面有图像。现在我想将数据从该视图推送到其他视图,因为每当我触摸该图像视图时,我都想选择位置并将该位置推送到其他视图。 UIScrollView 没有 navigationController 无法推送。
UIScrollView 位于 UIViewController 类之上。有没有办法将 UITouch 从 UIScrollView 发送到 UIViewController 类并让该类推送视图或者我必须解决一些问题。
我有以下 UIScrollView 类的代码,
ImageScrollView.m
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *t = [touches anyObject];
CGPoint touchInScrollView = [t locationInView:imageView];
NSLog(@"x: %f", floor(touchInScrollView.x));
NSLog(@"Y : %f", floor(touchInScrollView.y));
/****Cant be done since pushViewController is not allowed in UIScrollView.****/
DetailViewController *newView = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:nil];
[self.navigationController pushViewController:newView animated:YES];
}
【问题讨论】:
标签: iphone objective-c uiviewcontroller uiscrollview uitouch