2012年3月27日 星期二

iOS開發資源匯總


這裡總結了iPhone開發者開發過程中可能需要的一些資源:
如何用Facebook graphic api上傳視頻:
Keychain保存數據封裝:
對焦功能的實現:
自定義圓角Switch按件:
彈出窗口For iphone and ipad:
KVO詳解:
圖片瀏覽:
Dropbox實例:
當地天氣預報實例:
可伸縮的toolBar實例:
app資源保護相關:
cocos2d中也可用UIScrollView,UITableView,UIGestureRecognizers
UITableView兩級樹型結構:
iOS文檔導入導出:
CoreAnimation Demo:
CoreAnimation Dev:
iOS jabber聊天應用開發:客戶端開發
iOS jabber聊天應用開發:服務器搭建
iOS快速入門:
objc學習:
KeyChain封裝,安全存數據:
聲音相關:
彈珠游戲:
spring board類UI:
MacOS&iOS upnp:
ios block learn:
彈出框中輸入用戶名與密碼:
jailbreak iphone發送sms:
搜索itune裡app的url scheme:
橫豎屏切換自動調整位置:
鍵盤出現與消失view自動移動避免遮擋:
iOS類似firebug的web調試工具:
一個UI開源庫tapkulibrary,集成了calendar,coverflow
多列的TableView
mac的一個桌面程序,開源的
PSTreeGraph for iPad
文件預覽like QLPreviewController
Interface Builder中用自定義字體解決方案
有shader的UILabe
GCD學習
讓UITableView中有search功能教程
iPad閱讀器開發
ipad UI 24個免費資源
TableView的擴展
Orge3D for iOS
文檔比Three20更全的類Three20庫
iOS Boilerplate一個庫集合,方便開發
openCV for iOS
PageCurl for iOS
iOS PDF實例
Core Animation
Core Data注意的地方
GCD
MKMapView zoom level
HTML parser
openGLES
Charts繪制開源庫
apple 私有api文檔
類safari的切換頁面庫
自定義Slider組件
一些自定義組件:
QR Encoder二維碼識別
xml解析庫
wapper map for iOS
iOS unitity
socket
custom camera view
本地天氣demo
瀏覽器飛行動畫
切換動畫demo
Automatic Reference Counting
voip for ios development
圖像處理
腳本自動生成push notification所需證書
自定義ActivityIndicator
開源庫for ios
iOS網絡相關

2012年3月8日 星期四

[Xcode] 如何在 XCode 4.2 設定部分程式碼不使用 ARC 方式分享

相信很多人已經開始在使用 XCode 4.2 與 iOS5 的功能了吧!其中我最喜歡的功能之一就是 ARC (Automatic Reference Counting)。簡單的來說,ARC 就是可以讓你以後不用再擔心那邊要 release,哪裡又得 retain 了 ;而由編譯器在編譯的時候自動幫你偷偷加上去,所以你的程式碼裡面也不可以有 release,retain等。這個功能可以說是讓人又愛又恨。愛的是從此可以擺脫 Memory leak 的問題了,恨的是有很多第三方的 Library 幾乎都還沒有轉換爲與 ARC 相容的程式碼。

    當然你也可以自己改,不過有時候看到一大堆紅字,心都涼了一半了,還改嘞!給XCode幫你改嘛,有時候又直接跟你說它改不了,自己手動改唄。所以很多人一定很希望部分程式碼使用 ARC 但部分程式碼則維持原來的方式,也就是可以在程式碼內使用 release,retain 等方法的呼叫。真有這麼便宜的事嗎?還真有嘞!不過在 XCode 4.2 中並沒有一個很明確的地方可以設定,所以知道的人也不多,好在谷歌兄什麼鬼東西都找的到,試用過後覺得很不錯用,特與大家分享如下:

1. 選擇專案,此時會出現專案設定畫面。
2. 選擇你的 Target,並切換到 Build Phases 畫面。
3. 找到 Compile Sources 這個畫面,然後選擇你要設定不使用 ARC 的程式碼
4. 按下 Enter 鍵後,會跳出一個視窗要你輸入東西,在裏面輸入 -fno-objc-arc 就可以了。


from http://dev.iphonetw.net/thread-6385-1-1.html

2012年2月23日 星期四

Sort NSFileManager Results

Ref

Sorting strings like Finder

The following example shows how you can compare strings to order them in the same way as they’re presented in Finder. First, define a sorting function that includes the relevant comparison options (for efficiency, pass the user's locale as the context—this way it's only looked up once).
int finderSortWithLocale(id string1, id string2, void *locale)
{
    static NSStringCompareOptions comparisonOptions =
        NSCaseInsensitiveSearch | NSNumericSearch |
        NSWidthInsensitiveSearch | NSForcedOrderingSearch;
 
    NSRange string1Range = NSMakeRange(0, [string1 length]);
 
    return [string1 compare:string2
                    options:comparisonOptions
                    range:string1Range
                    locale:(NSLocale *)locale];
}

2011年12月21日 星期三

偵測iOS還剩下多少記憶體的程式碼(iOS - detect total available/free disk space on the iPhone/iPad device)


-(float)getFreeDiskspace {
float totalSpace = 0.0f;
float totalFreeSpace = 0.0f;
NSError *error = nil;  NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);  NSDictionary *dictionary = [[NSFileManager defaultManager] attributesOfFileSystemForPath:[paths lastObject] error: &error];  
if (dictionary) {  NSNumber *fileSystemSizeInBytes = [dictionary objectForKey: NSFileSystemSize];  NSNumber *freeFileSystemSizeInBytes = [dictionary objectForKey:NSFileSystemFreeSize];
totalSpace = [fileSystemSizeInBytes floatValue];
totalFreeSpace = [freeFileSystemSizeInBytes floatValue];
NSLog(@"Memory Capacity of %f MiB with %f MiB Free memory available.", ((totalSpace/1024.0f)/1024.0f), ((totalFreeSpace/1024.0f)/1024.0f));
} else {  NSLog(@"Error Obtaining System Memory Info: Domain = %@, Code = %@", [error domain], [error code]);  }  
return totalFreeSpace;
}