我有一个固定的肖像应用程序使用objective-c,我有一个按钮点击打开MWPhotoBrowser浏览图像。现在它在纵向模式下工作得很好,但我想让MWPhotoBrowser在纵向和横向模式下都可以旋转手机。我该怎么做呢,下面是我的代码:
- (void) prepareForPhotoAlbum:(NSArray*)photoObjs {
self.photoURLArrays = [[NSMutableArray alloc]init];
for(int i=0 ; i<photoObjs.count ; i++){
NSDictionary* dictOfImageObj = photoObjs[i];
[self.photoURLArrays addObject:[MWPhoto photoWithURL: [NSURL URLWithString:[NSString stringWithFormat:@"%@/%@",ServerTopicImageURL,dictOfImageObj[@"filename"]]]]];
}
MWPhotoBrowser *browser = [[MWPhotoBrowser alloc] initWithDelegate:self];
// Set options
browser.displayActionButton = YES;
browser.displayNavArrows = NO;
browser.zoomPhotosToFill = YES;
[browser setCurrentPhotoIndex:0];
browser.wantsFullScreenLayout = YES;
[self.navigationController pushViewController:browser animated:YES];
[browser showPreviousPhotoAnimated:YES];
[browser showNextPhotoAnimated:YES];
} 发布于 2016-12-19 18:27:43
你有2个选择,你可以使应用程序是纵向+横向,通过你的VC和添加3种旋转方法,shouldAutorotate,preferredOrientation和presentationOrientation,或者,你可以在这个特定的VC你可以注册设备方向的NotificationCenter通知,即使手机方向可能是锁定的和/或应用程序方向锁定,你应该得到一个旋转发生的通知,并应用自己的动画转换,使它看起来像横向,这是我所知道的大多数相机应用程序似乎这样做,因为你不想相机旋转的视口。
NotificationCenter.default.addObserver(self, selector: Selector, name: NSNotification.Name.UIDeviceOrientationDidChange, object: nil)https://stackoverflow.com/questions/41219930
复制相似问题