以下是我的嘗試。我在導航欄中添加了一個rightBarButtonItem。然後用下面的方法連接它。我究竟做錯了什麼? 當我點擊按鈕時,該方法被調用,因爲我看到日誌。當它被調用時沒有可見的事情發生。如果我反覆點擊按鈕,圖像會閃爍。如何將旋轉照片功能添加到MWPhotoBrowser?
- (void)rotatedImage
{
NSLog(@"rotatedImage");
id <MWPhoto> assetPhoto = [self photoAtIndex:_currentPageIndex];
UIImageOrientation imageOrientation = assetPhoto.underlyingImage.imageOrientation;
UIImageOrientation orientationToBe;
if (imageOrientation == UIImageOrientationLeft) orientationToBe = UIImageOrientationDown;
else if (imageOrientation == UIImageOrientationDown) orientationToBe = UIImageOrientationRight;
else if (imageOrientation == UIImageOrientationRight) orientationToBe = UIImageOrientationUp;
else orientationToBe = UIImageOrientationLeft;
UIImage *rotatedImage = [UIImage imageWithCGImage:[assetPhoto.underlyingImage CGImage] scale: 1 orientation:orientationToBe];
MWPhoto *r = [MWPhoto photoWithImage:rotatedImage];
[_photos replaceObjectAtIndex:_currentPageIndex withObject:r];
[self reloadData];
}
這段代碼是否被調用?如果是這樣,會發生什麼?提供更多細節。 – rmaddy
代碼被調用,因爲我看到日誌。當它被調用時沒有可見的事情發生。如果我反覆點擊按鈕,圖像會閃爍。 – user299648
我也嘗試使用context.but旋轉圖像,但它不rotate.have旋轉圖像succesfuly?如果是,那麼如何? – ABJ