一、UICollectionView 書本翻頁效果(作者:eett)
利用 UICollectionView 模擬書本翻頁的過場動畫,還原真實的翻閱手感。
測試環境:Xcode 6.2、iOS 6.0 以上。

二、自定義導航(作者:劉廷信)
作者利用閒暇時間動手做的一個自定義導航範例,可作為客製化轉場的參考。
測試環境:Xcode 6.2、iOS 6.0 以上。

三、一個折線圖(作者:lander_li)
作者以前寫的一個簡單折線圖,尚未封裝整合,但可直接看效果、參考實作。
測試環境:Xcode 6.2、iOS 6.0 以上。

四、PasswordInputView(作者:lxyz22zp)
一個簡潔的交易密碼輸入元件,適合需要自訂輸入框的使用情境。
測試環境:Xcode 6.2、iOS 6.0 以上。

五、iOS 相冊圖片多選(含預覽)(作者:iOSSinger)
1. 先導入所需頭文件:
#import
2. 取得相冊分組:
- (NSMutableArray *)groups{ if (_groups == nil) { _groups = [NSMutableArray array]; dispatch_async(dispatch_get_main_queue(), ^{ [self.assetsLibrary enumerateGroupsWithTypes:ALAssetsGroupAll usingBlock:^(ALAssetsGroup *group, BOOL *stop) { if(group){ [_groups addObject:group]; [self.tableView reloadData]; } } failureBlock:^(NSError *error) { UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"提示" message:@"訪問相冊失敗" delegate:self cancelButtonTitle:@"確定" otherButtonTitles:nil]; [alertView show]; }]; }); } return _groups; }3. 遍歷某分組中的資源(含圖片、影片等),這裡只取圖片:
- (void)setGroup:(ALAssetsGroup *)group{ _group = group; [group enumerateAssetsUsingBlock:^(ALAsset *asset, NSUInteger index, BOOL *stop) { if (asset == nil) return ; if ([[asset valueForProperty:ALAssetPropertyType] isEqualToString:ALAssetTypePhoto]) { SGAssetModel *model = [[SGAssetModel alloc] init]; model.thumbnail = [UIImage imageWithCGImage:asset.thumbnail]; model.imageURL = asset.defaultRepresentation.url; [self.assetModels addObject:model]; } }]; }4. 透過遍歷可取得縮圖、原圖 URL、拍攝地點與時間等資訊;這裡用縮圖展示、原圖 URL 取原圖。特別注意:系統會在子執行緒中取得原圖。
- (void)originalImage:(void (^)(UIImage *))returnImage{ ALAssetsLibrary *lib = [[ALAssetsLibrary alloc] init]; [lib assetForURL:self.imageURL resultBlock:^(ALAsset *asset) { ALAssetRepresentation *rep = asset.defaultRepresentation; CGImageRef imageRef = rep.fullResolutionImage; UIImage *image = [UIImage imageWithCGImage:imageRef scale:rep.scale orientation:(UIImageOrientation)rep.orientation]; if (image) { returnImage(image); } } failureBlock:^(NSError *error) { }]; }5. 其餘程式碼負責處理資料模型與展示效果,完整實作可參考作者 GitHub,歡迎指正。
測試環境:Xcode 6.2、iOS 6.0 以上。
