2015年7月28日 星期二

XCode6 製作Static Framework

1.New Project -> Framework & Library -> Cocoa Touch Framework

2.在專案中建立Class

3.在專案設定檔中,選擇TARGET -> Build Phases, 將步驟2新增的Class h檔加入
「Headers」區塊
4.點擊專案Target,Edit Scheme, 「Run」build Configuration 選擇「release or debug」,此設定將決定輸出的framework版本

5.Compiler裝置選擇「iOS Device」,並且進行Compiler

6.在XCode專案結構列表中找到「Products」資料夾,點擊右鍵「Show in finder」,即可看到framework實體檔案,前往此資料夾「上一頁」即可看到Debug & Release兩個版本資料夾 經過上述步驟可以產出Release or debug .framework檔案 

以下步驟為合併兩個.framework,以便開發時不需更換framework 

1.在framework專案中設定「TARGET」->「Build Setting」-->「Linking」->「Mach-O Type」改為「Static Library」(專案使用framework時可以不需加在 Embedded Binaries區塊中)

 2.在framework專案中「New Target」,選擇「Aggregate」 

3.在Aggregate Target中選擇「Build Phases」, add Script 

4.輸入下列Script

 FRAMEWORK_NAME="${PROJECT_NAME}"
SIMULATOR_LIBRARY_PATH="${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${FRAMEWORK_NAME}.framework"

 DEVICE_LIBRARY_PATH="${BUILD_DIR}/${CONFIGURATION}-iphoneos/${FRAMEWORK_NAME}.framework" 

UNIVERSAL_LIBRARY_DIR="${BUILD_DIR}/${FRAMEWORK_NAME}.framework" 

FRAMEWORK="${UNIVERSAL_LIBRARY_DIR}/${FRAMEWORK_NAME}.framework"

 rm -rf "${UNIVERSAL_LIBRARY_DIR}"

 mkdir "${UNIVERSAL_LIBRARY_DIR}"

 cp -R "${SIMULATOR_LIBRARY_PATH}/Headers" "${UNIVERSAL_LIBRARY_DIR}/Headers"

cp -R "${SIMULATOR_LIBRARY_PATH}/Modules" "${UNIVERSAL_LIBRARY_DIR}/Modules"

cp -R "${SIMULATOR_LIBRARY_PATH}/Info.plist" "${UNIVERSAL_LIBRARY_DIR}/Info.plist" 

lipo -create "${SIMULATOR_LIBRARY_PATH}/${FRAMEWORK_NAME}" "${DEVICE_LIBRARY_PATH}/${FRAMEWORK_NAME}" -output "${UNIVERSAL_LIBRARY_DIR}/${FRAMEWORK_NAME}"

 5.Run即可輸出合併的framework, 名稱為「專案名稱.framework」

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;