前回、MWPhotoBrowserの導入方法について書きましたが、今回は、1枚の写真を表示するViewとして使ってみることに。
MWPhotoBrowser *photoBrowser = [[MWPhotoBrowser alloc] initWithDelegate:self]; // Set options photoBrowser.displayActionButton = NO; photoBrowser.displayNavArrows = NO; photoBrowser.displaySelectionButtons = NO; photoBrowser.zoomPhotosToFill = YES; photoBrowser.alwaysShowControls = NO; photoBrowser.enableGrid = NO; photoBrowser.startOnGrid = NO; photoBrowser.wantsFullScreenLayout = NO; // Present [self.navigationController pushViewController:photoBrowser animated:YES]; // Manipulate [browser showNextPhotoAnimated:NO]; [browser showPreviousPhotoAnimated:NO]; [browser setCurrentPhotoIndex:0]; //MWPhotoBrowserDelegate - (NSUInteger)numberOfPhotosInPhotoBrowser:(MWPhotoBrowser *)photoBrowser { return 1; } - (id <MWPhoto>)photoBrowser:(MWPhotoBrowser *)photoBrowser photoAtIndex:(NSUInteger)index { if (index == 0){ UIImage *image; return [MWPhoto photoWithImage:image]; } return nil; }上のように組めば単発のViewerとして機能します。
0 コメント:
コメントを投稿