0
我有一個雙重應用程序,並將touchesBegan的代碼塊從iPhone代碼複製到iPad。我沒有做任何改變,並且該方法總是給我一個零和x和y的第一次觸摸。iPhone touchesBegian不在iPad上工作,x和y總是爲零
的代碼塊:
-(void) touchesBegan: (NSSet *) touches withEvent: (UIEvent *) event {
int iCardId;
NSSet *allTouches = [event allTouches];
// we are dealing with one finger get first touch
// get first touch
UITouch *touch=[[allTouches allObjects] objectAtIndex:0];
// get the x and y
CGPoint pt = [touch locationInView: self.view];
float x=pt.x; // this is always a zero
float y=pt.y; // this is always a zero
.........
.........
.........
}
嗨,是iPad嗎?該代碼適用於iPhone,並將其複製到iPad,其中它不起作用,iPad模擬器 –
。 – mbm29414