Skip to content
This repository was archived by the owner on Jul 2, 2022. It is now read-only.

Commit edd6750

Browse files
committed
The image picker now rotates
1 parent 00bef5a commit edd6750

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

CodeHub.iOS/ViewControllers/MarkdownComposerViewController.cs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,27 @@ private async void UploadImage(UIImage img)
111111
}
112112
}
113113

114+
private class RotatableUIImagePickerController : UIImagePickerController
115+
{
116+
public override bool ShouldAutorotate()
117+
{
118+
return true;
119+
}
120+
121+
public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations()
122+
{
123+
return UIInterfaceOrientationMask.All;
124+
}
125+
126+
public override UIInterfaceOrientation PreferredInterfaceOrientationForPresentation()
127+
{
128+
return UIApplication.SharedApplication.StatusBarOrientation;
129+
}
130+
}
131+
114132
private void SelectImage()
115133
{
116-
var imagePicker = new UIImagePickerController();
134+
var imagePicker = new RotatableUIImagePickerController();
117135
imagePicker.NavigationControllerDelegate = new ImagePickerDelegate();
118136
imagePicker.SourceType = UIImagePickerControllerSourceType.PhotoLibrary;
119137
imagePicker.MediaTypes = UIImagePickerController.AvailableMediaTypes(UIImagePickerControllerSourceType.PhotoLibrary);

0 commit comments

Comments
 (0)