2012-06-19 32 views
0

我试图自定义日历程序(最初为iPhone编写),我发现(http://code.google.com/p/iphonecal/)在iPad上工作。它是使用控制器和UIView的.xib文件编写的。“touchesEnded”无法识别整个视图

出于某种原因,它不会“触发”touchesEnded在整个视图的右侧2/3处的任何地方。当使用iPhone模拟器时,它工作正常,但不是iPad模拟器。

据我了解,touchesEnded监视整个视图,但在这种情况下似乎没有这样做。

什么可能会导致此问题的任何想法?

更新:它回来了...我重置模拟器,做了一个干净的,重新构建,问题又回来了。这里是一个甚至没有获得通过的UIView的右手边摸代码:

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
//-- touchesEnded 
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
- (void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { 

    int width = self.frame.size.width; 

    UITouch* touch = [touches anyObject]; 
    CGPoint touchPoint = [touch locationInView:self]; 
    //UIView* theview=[self hitTest:touchPoint withEvent:event]; 

    if(touchPoint.x < 40 && touchPoint.y < headHeight) 
     [self movePrevMonth]; 
    else if(touchPoint.x > width - 40 && touchPoint.y < headHeight) 
     [self moveNextMonth]; 
    else if(touchPoint.y > headHeight) 
     [self touchAtDate:touchPoint]; 

} 
+0

你可以给我们你的代码吗?谢谢。 – pasawaya

回答

0

我发现这两个的.xib文件无法被设置为使用iPad上的问题......。 ..我找到了答案here,它告诉我如何更改.xib文件的源代码......它现在就像一个冠军!