程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> 編程綜合問答 >> nsdictionary-NSDictionary 到 CGPoint

nsdictionary-NSDictionary 到 CGPoint

編輯:編程綜合問答
NSDictionary 到 CGPoint

正在開發一個游戲,其中需要子彈單擊和雙擊分別出現不同的效果。

在touch開始方法中:

- (void)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event 
{
    for( UITouch *touch in touches ) 
    {

        CGPoint location = [touch locationInView: [touch view]];
        location = [[CCDirector sharedDirector] convertToGL: location];

        NSLog(@"TOUCH LOCATION IN TOUCH BEGAN  = (%f , %f)", location.x , location.y);

        NSUInteger tapCount = [touch tapCount];

        switch (tapCount)
        {
            case 1:
            {
                NSDictionary * touchloc = [NSDictionary dictionaryWithObject:[NSValue valueWithCGPoint:location] forKey:@"location"];
                [self performSelector:@selector(startTimer:) withObject:touchloc afterDelay:3];
                break;
            }   
            case 2:
            {
                [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(startTimer) object:nil];
                [self performSelector:@selector(removeBall) withObject:nil afterDelay:1];
                break;
            }
            default:
            {
                break;
            }
        }
  }

現在在perform selector(startTimer:)得到NSPoint觸屏的坐標點。我想知道怎麼將這些坐標點轉換成CGPoints?

最佳回答:


CGPointCreateDictionaryRepresentationCGPointMakeWithDictionaryRepresentation

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved