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

你可能感兴趣的:(MWPhotoBrowser的使用)