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"];