在我的应用程序中我有一个UIScrollView,并在其中我已经以编程方式创建UIImageViews。这是基于Xcode中的Tab-bar模板。我想要做的是在特定图像被按下时更改Tabs,并且尽管我可以将该事件注册为触摸,但更改tabIndex不会执行任何操作。 在以下代码中输入:ScrollView与图像 - 改变touchesended选项卡不起作用
UITabBarController *tab=self.tabBarController;
if (tab){
NSLog(@"Good");
}
else {
NSLog(@"No Good");
总是导致无法正常记录。我写的代码可以在这里,在这里我的UIScrollView的类型是ScrollViewer中看出: @implementation的ScrollViewer - (无效)touchesEnded:(NSSet中*)触及withEvent:方法(*的UIEvent)事件{
if (!self.dragging) {
NSLog(@"Recieved Touch!");
UITouch *aTouch = [touches anyObject];
MainView *theInstance = [[MainView alloc] init];
CGPoint point = [aTouch locationInView:self];
theInstance.ycoord = point.y;
[theInstance touchHand];
}
[super touchesEnded: touches withEvent: event];
}
@end
任何帮助表示感谢,谢谢!
结束了使用Autonomy的答案从另一个问题[Autonomy的答案这里] [1] [1]:http://stackoverflow.com/questions/1207287/whats-the-trick-to-pass事件到下一个响应者在响应者链 – G4laxy 2012-08-13 02:54:28