2014年4月14日 星期一

UIView Rotation Forever

CAKeyframeAnimation *theAnimation = [CAKeyframeAnimation animation];
theAnimation.values = [NSArray arrayWithObjects:
[NSValue valueWithCATransform3D:CATransform3DMakeRotation(0, 0,0,1)],
[NSValue valueWithCATransform3D:CATransform3DMakeRotation(3.13, 0,0,1)],
[NSValue valueWithCATransform3D:CATransform3DMakeRotation(6.26, 0,0,1)],
nil];
theAnimation.cumulative = YES;
theAnimation.duration = 1.0;
theAnimation.repeatCount = 5;
theAnimation.removedOnCompletion = YES;

2014年3月21日 星期五

Google AdMob

1.import Framework
  • CoreData.framework
  • AdSupport.framework
  • SystemConfiguration.framework
  • MessageUI.framework
  • AudioToolbox.framework
  • StoreKit.framework
  • CoreTelephony.framework
  • AVFoundation.framework
2.Project → Targets → Build Settings → Other Linker Flags的地方加上「-ObjC」


3.設定測試狀態

- (GADRequest *)createTestRequest{
      GADRequest *request = [GADRequest request];
      request.testDevices = [NSArray arrayWithObjects:GAD_SIMULATOR_ID, @"你的實機ID", nil];
      return request;
}

4.設定loadRequest測試參數

將

[bannerView_ loadRequest:[GADRequest request]];

改為

[bannerView_ loadRequest:[self createTestRequest]];

2014年3月14日 星期五

使用 RegexKitLite iOS Framework

1.下載 RegexKitLite
  • http://regexkit.sourceforge.net/
2.專案新增 libicucore.dylib frameworks

2014年3月13日 星期四

Git + Bitbucket 帳號切換


1.切到目標資料夾下

2.git init (如果是新專案的話)

3.輸入下列

git config user.name "Your Name"
git config user.email "you@example.com"

done

2014年3月12日 星期三

UIView 曲線動畫Sample code

       CGPoint endpoint=[self.view convertPoint:point1 fromView:carBG];
       UIBezierPath *path=[UIBezierPath bezierPath];

        CGPoint startPoint=[self.view convertPoint:point fromView:self.myTableView];
        [path moveToPoint:startPoint];
        //贝塞尔曲线中间点
        float sx=startPoint.x;
        float sy=startPoint.y;
        float ex=endpoint.x;
        float ey=endpoint.y;
        float x=sx+(ex-sx)/3;
        float y=sy+(ey-sy)*0.5-400;
        CGPoint centerPoint=CGPointMake(x,y);
        [path addQuadCurveToPoint:endpoint controlPoint:centerPoint];
       
        CAKeyframeAnimation *animation=[CAKeyframeAnimation animationWithKeyPath:@"position"];
        animation.path = path.CGPath;
        animation.removedOnCompletion = NO;
        animation.fillMode = kCAFillModeForwards;
        animation.duration=0.8;
        animation.delegate=self;
        animation.autoreverses= NO;
        animation.timingFunction=[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn];
        [layer addAnimation:animation forKey:@"buy"];

2014年2月28日 星期五

CCParticleSystemQuad crash Cocos2d V1.1-rc0

移除粒子系統2d框架的bug



修改CCScheduler.m


找到 - (void) removeUpdateFromHash:(tListEntry*)entry

tHashUpdateEntry * element = NULL;
    
    HASH_FIND_INT(hashForUpdates, &entry->target, element);
    if( element ) {
        // list entry
        DL_DELETE( *element->list, element->entry );
        free( element->entry );
        
        // hash entry
        id target = element->target;
        HASH_DEL( hashForUpdates, element);
        free(element);
        
        // target#release should be the last one to prevent
        // a possible double-free. eg: If the [target dealloc] might want to remove it itself from there
        [target release];
    }