我必须调用视图控制器中存在的方法,该视图控制器的引用在视图中可用。当我尝试像任何其他方法一样调用方法时,出于某种原因,iPhone只是忽略了该调用。有人可以解释为什么会发生这种情况,我该如何去调用这种方法呢?从视图调用视图控制器中的方法
在视图中我有这样的方法:
-(void) touchesBegan :(NSSet *) touches withEvent:(UIEvent *)event{
NSArray* mySubViews = [self subviews];
for (UITouch *touch in touches) {
int i = 0;
for(; i<[mySubViews count]; i++){
if(CGRectContainsPoint([[mySubViews objectAtIndex:i] frame], [touch locationInView:self])){
break;
}
}
if(i<[mySubViews count]){
// viewController is the reference to the View Controller.
[viewController pointToSummary:[touch locationInView:self].y];
NSLog(@"Helloooooo");
break;
}
}
}
每当触摸事件被触发,Hellooooo被印在控制台但在此之前,该方法会被忽略
你可以张贴一些代码? – itsmatt 2010-03-31 17:12:11