在我的應用程序中我有一個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