2014年10月28日 星期二

Objective-c AFNetwork POST 巢狀結鋯

在POST  巢狀參數時,會發生raw data 參數index跑掉的問題

修改AFURLRequestSerialization.m    AFQueryStringPairsFromKeyAndValue function

2014年8月25日 星期一

CAAniamtion TimingFunction 參數調整

由於CAAnaimation 內建Ease function實在太少,可透過 functionWithControlPoints,調整出曲線 function,做出Q彈的動畫

ease function 參考圖:

圖片link:
https://camo.githubusercontent.com/893dc398d7fe5aa586b82631f65b4c2f4b47d147/687474703a2f2f692e696d6775722e636f6d2f65384f637368762e706e67




調整參數產生器:

http://netcetera.org/camtf-playground.html


範例:

CATransition *transtion = [CATransition animation];
    transtion.duration = 1.0f;
    [transtion setTimingFunction:[CAMediaTimingFunction functionWithControlPoints:0.8f :0.0f :0.2 :3.0f]];
    [transtion setType:@"cube"];
    [transtion setSubtype:kCATransitionFromBottom];
    
    [label.layer addAnimation:transtion forKey:@"transtionKey"];



2014年8月20日 星期三

Git 移除資料夾遇到 Operation not permitted


刪除資料夾
git rm -r --cached "資料夾名稱"

另外:刪除所有該delete的檔案

git rm $(git ls-files --deleted)

2014年6月9日 星期一

Mac 簡易架設 Git Server

Mac 簡易架設 Git Server

參考來源:
1.http://git-scm.com/book/zh-tw/%E4%BC%BA%E6%9C%8D%E5%99%A8%E4%B8%8A%E7%9A%84-Git-%E6%9E%B6%E8%A8%AD%E4%BC%BA%E6%9C%8D%E5%99%A8

2.http://blog.longwin.com.tw/2011/03/build-git-env-share-over-ssh-2011/

3.https://www.youtube.com/watch?v=o1x-WRZrTTo

Server:

1. cd ~  (跳到Home目錄底下)
2. mkdir gitrepo.git (在Home目錄建立名為 gitrepo.git的資料夾

3. cd /gitrepo.git (進入資料夾)
4. git init --bare (--bare代表將.git隱藏目錄放到資料夾根目錄,此動作完成Server端初始化)
5. 將Client端public key 內容寫入 /.ssh/authorized.keys 裡面
7. vi ~/.ssh/authorized.keys(進入authorized.keys 寫入client public key)
6. 在 OS 共享設定打開「遠端登入」,例如:「若要從遠端登入此電腦,請輸入「ssh apple@10.1.1.199」。」

Client 製作public key

1. ssh-keygen -t rsa  (產生 id_rsa.pub 公鑰在 .ssh目錄底下)
2.將產生的公鑰檔案「 id_rsa.pub」寄給Server,讓Server加入到authorized.keys中


Client 端建立Repository

1. cd ~  (跳到Home目錄底下)
2. cd Desktop (跳到桌面)
3. mkdir local_repository(在桌面建立一個資料夾放置本地Repository)
4. cd local_repository(進入local_repository 資料夾)
5. vi test (新增一個檔案test,  編輯檔案時 shift + q  可跳出輸入項目,w儲存  q離開  q! 儲存離開)

6. git add . (將檔案「test」加入stage)
7. git commit -m 'initial upload'
8. git remote add origin apple@10.1.1.199:gitrepo.git(加入remote,由於遠端Repository在Home目錄底下,在冒號後方加入遠端Repository名稱 )
9. git push origin master (將本地端Repository 推上遠端)


Client temp clone and modify Repository

1. cd /tmp(進入temp)
2. cd clone git clone apple@10.1.1.199:gitrepo.git (從遠端複製repository到local tmp)
3. cd gitrepo (進入tmp底下gitrepo資料夾)
4. vi test2 (新增「test2」 檔案)
5. vi test (修改「test」檔案內容)
6. git add .
7. git commit -m 'user 2 first time commit'
8. git push


Client User1 Pull Repository

1. cd ~  (跳到Home目錄底下)
2. cd Desktop (跳到桌面)
3. cd local_repository(進入local_repository 資料夾)
4. git pull oringin master(將遠端Repository拉回)




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