一個簡單的iOS照片瀏覽器:MWPhotoBrowser

jopen 10年前發布 | 141K 次閱讀 iOS開發 移動開發 MWPhotoBrowser

這是一個簡單的iOS照片瀏覽器可選的網格視圖,標題和選中功能。

MWPhotoBrowser能夠展示一張或多張圖片,圖片可以來自 UIImage objects, 或 URLs to files, Web圖片或資源庫。這個照片瀏覽器能夠無縫地處理下載和緩存來自Web的圖片。照片可放大,縮小,平移,和可選的(可定制),可以顯示標題。

// Create array of MWPhoto objects
self.photos = [NSMutableArray array];
[photos addObject:[MWPhoto photoWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"photo2l" ofType:@"jpg"]]]];
[photos addObject:[MWPhoto photoWithURL:[NSURL URLWithString:@"

// Create browser (must be done each time photo browser is // displayed. Photo browser objects cannot be re-used) MWPhotoBrowser *browser = [[MWPhotoBrowser alloc] initWithDelegate:self];

// Set options browser.displayActionButton = YES; // Show action button to allow sharing, copying, etc (defaults to YES) browser.displayNavArrows = NO; // Whether to display left and right nav arrows on toolbar (defaults to NO) browser.displaySelectionButtons = NO; // Whether selection buttons are shown on each image (defaults to NO) browser.zoomPhotosToFill = YES; // Images that almost fill the screen will be initially zoomed to fill (defaults to YES) browser.alwaysShowControls = NO; // Allows to control whether the bars and controls are always visible or whether they fade away to show the photo full (defaults to NO) browser.enableGrid = YES; // Whether to allow the viewing of all the photo thumbnails on a grid (defaults to YES) browser.startOnGrid = NO; // Whether to start on the grid of thumbnails instead of the first photo (defaults to NO) browser.wantsFullScreenLayout = YES; // iOS 5 & 6 only: Decide if you want the photo browser full screen, i.e. whether the status bar is affected (defaults to YES)

// Optionally set the current visible photo before displaying [browser setCurrentPhotoIndex:1];

// Present [self.navigationController pushViewController:browser animated:YES];

// Manipulate [browser showNextPhotoAnimated:YES]; [browser showPreviousPhotoAnimated:YES]; [browser setCurrentPhotoIndex:10];</pre>

Alt    Alt    Alt    Alt    Alt    Alt

項目主頁:http://www.baiduhome.net/lib/view/home/1414047521372

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!