記錄一些有用的開源項目,希望通過學習別人的東西來提高自己的水平。
10個最有用的iOS開源項目:http://www.raywenderlich.com/21987/top-10-most-useful-ios-libraries-to-know-and-love
一、網絡請求——AFNetworking
下載地址:https://github.com/AFNetworking/AFNetworking
參考教程:Everybody Loves AFNetworking And So Can You!
要求:1、iOS 5 or later. 2、ARC.
提供的例子按照MVC編寫,很值得學習;Model:進行網絡請求,通過block返回數據;View:封裝一個Model對象,等網絡請求完畢,通過Model對象的Setter更新視圖;Controller:Model和View的中間人。
二、消息提示——MBProgressHUD
下載地址:https://github.com/jdg/MBProgressHUD
三、第三方庫管理——CocoaPods
下載地址:https://github.com/CocoaPods/CocoaPods
參考教程:http://www.raywenderlich.com/12139/introduction-to-cocoapods
的確是個好東西,可以很方便的管理第三方庫,清晰知道項目引用的庫有哪些和它們的版本。
四、消息提示——DejalActivityView
下載地址:https://github.com/Dejal/DejalActivityView.git
要求:1、iOS 5 or later. 2、ARC.
相比MBProgressHUD,感覺使用更方便,提供蘋果官方的"Loading..."視圖、HUD動畫效果、鍵盤HUD。
五、無限循環滾動視圖——InfinitePagingView
下載地址:https://github.com/caesarcat/InfinitePagingView.git
無限循環滾動視圖,支持橫向和縱向,不過有個問題是視圖個數不能是2,其他都可以。
1、iOS 5 or later. 2、ARC.
六、上拉和下拉更新——SVPullToRefresh
下載地址:https://github.com/samvermette/SVPullToRefresh.git
1、iOS 5 or later. 2、ARC.
只需要一句代碼就可以添加上拉刷新(下拉刷新),拉動過程的不同狀態可以使用自定義視圖。
七、SDWebImage
下載地址:https://github.com/rs/SDWebImage.git
圖片異步緩存(內容和硬盤),網絡異步加載。
——以下內容更新於2013-3-29
八、HUD——SVProgressHUD
下載地址:https://github.com/samvermette/SVProgressHUD
相比MBProgressHUD,更容易使用,比較適合更新數據的情況。
[SVProgressHUD showWithStatus:@"更新"];// 更新HUD
[SVProgressHUD showSuccessWithStatus:@"更新成功"];// 帶勾圖片的成功HUD
[SVProgressHUD showErrorWithStatus:@"更新失敗"];// 帶叉圖片的失敗HUD
九、分段選擇——SVSegmentedControl
下載地址:https://github.com/samvermette/SVSegmentedControl
要求:1、iOS 5 or later. 2、ARC.
模仿UISegementedControl可以分段選擇,樣式像UISwitch,很容易就可以做成不錯的效果。
十、分段選擇——HMSegmentedControl
下載地址:https://github.com/HeshamMegid/HMSegmentedControl
要求:1、iOS 5 or later. 2、ARC.
類似android的風格。
十一、UIWebView瀏覽器——SVWebViewController
下載地址:https://github.com/samvermette/SVWebViewController
要求:1、iOS 5 or later. 2、ARC.
支持iPhone和iPad,提供上一頁、下一頁、刷新、瀏覽器打開、鏈接發送郵件功能。
十二、圖片瀏覽器——MWPhotoBrowser
下載地址:https://github.com/mwaterfall/MWPhotoBrowser
模仿iOS原生圖片瀏覽器,適用本地圖片和網絡圖片。
十三、Keychain——SSKeychain
下載地址:https://github.com/soffes/sskeychain
Keychain的Objective-C封裝,簡單易用。
十四、屬性標籤——TTTAttributedLabel
下載地址:https://github.com/mattt/TTTAttributedLabel
標籤支持不同屬性,可以檢測鏈接、電話、地址、事件等。
——以下內容更新於2013-5-11
十五、網格——https://github.com/steipete/PSTCollectionView
下載地址:https://github.com/steipete/PSTCollectionView
仿iOS6的UICollectionView,向前兼容iOS4.3+。
十六、滾動視圖——SwipeView
下載地址:https://github.com/nicklockwood/SwipeView
使用UIScrollView實現橫向滾動,仿UITableView的datasource/delegate設計,可以動態加載視圖,reloadData,循環等。
Fork:https://github.com/bluesLf/SwipeView.git ,增加滾動的縮放和透明效果。
十七、選擇器——ActionSheetPicker
下載地址:https://github.com/TimCinel/ActionSheetPicker
iPhone/iPod = Picker + UIActionSheet
iPad = Picker + UIPopoverController
——以下內容更新於2013-8-2
十八、扁平顏色——UIColor-MLPFlatColors
下載地址:https://github.com/EddyBorja/UIColor-MLPFlatColors.git
十九、iOS7風格的UIKit——FlatUIKit 和 UI7Kit
下載地址:https://github.com/Grouper/FlatUIKit.git 和 https://github.com/youknowone/UI7Kit
模仿iOS7的扁平化風格,替換原生UIKit,爲iOS7以下版本提供iOS7的扁平化風格。
二十、zip解壓縮——ZipArchive
下載地址:https://github.com/mattconnolly/ZipArchive.git
zip解壓縮工具庫。
二十一、gif播放——OLImageView
下載地址:https://github.com/ondalabs/OLImageView
支持gif播放。