MWPhotoBrowser的使用

1.創建并設置代理

MWPhotoBrowser*browser = [[MWPhotoBrowseralloc]initWithDelegate:self];

其中代理必須實現的兩個方法

#pragma - mark MWPhotoBrowserDelegate- (NSUInteger)numberOfPhotosInPhotoBrowser:(MWPhotoBrowser

*)photoBrowser

{

returnself.original_picArrM.count

;

}

- (id)photoBrowser:(MWPhotoBrowser*)photoBrowser photoAtIndex:(NSUInteger

)index

{

if(index

)

return[self.original_picArrMobjectAtIndex

:index];

returnnil

;

}

- (void)photoBrowserDidFinishModalPresentation:(MWPhotoBrowser

*)photoBrowser

{

//移除控制器1.清空數組

[

self.original_picArrMremoveAllObjects];//??? self.original_picArrM = nil;

[

self.photoBrowserdismissViewControllerAnimated:YEScompletion:nil

];

//2.控制器置nil

self.photoBrowser=nil

;

}

2.MWPhotoBrowser的屬性

// 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)

電池狀態欄和導航欄,tabBar

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];

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容