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];
}
你可以給我們你的代碼嗎?謝謝。 – pasawaya