1
我的問題是,我使用這種方法之前,它是完美的工作,今天我試圖在另一個項目中做到這一點。這是代碼Cocos2d和ios5:ccTouchesBegan
- (void) ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch* touch = [touches anyObject];
CGPoint touchPos = [[CCDirector sharedDirector] convertToGL:[touch locationInView:[touch view]]];
CCLOG(@"(%d , %d)",touchPos.x,touchPos.y);
}
什麼我得到奇怪的是輸出的輸出總是與此類似(0,1081286656)
我會很喜歡,如果有人可以幫助我
問候 艾哈邁德
您正在使用錯誤的字符串格式說明符。 'CGPoint'的'x'和'y'字段是'CGFloat's。你需要使用'%f'。 – albertamg
哈哈非常感謝,這是:) – shbli
是的,你確定你可以,這主要是因爲我在Qt和Objective-C上開發; p就是這樣; p – shbli