UIImagePickerController not presenting in iOS 8

后端 未结 12 1579
借酒劲吻你
借酒劲吻你 2020-12-12 16:39

Is anyone else having an issue with UIImagePickerController in iOS 8? The method below works perfectly well in iOS 7 on an iPad, but I get the following error

12条回答
  •  我在风中等你
    2020-12-12 17:06

    Here's a Xamarin solution. What worked for me was to add my actions to a Dismissed event handler.

    this.btnPhoto.TouchUpInside += (sender, e) =>
    {
        actionSheet = new UIActionSheet ("Add Photo");
        actionSheet.AddButton ("Take Photo");
        actionSheet.AddButton ("Select from Library");
        actionSheet.AddButton ("Cancel");
        actionSheet.DestructiveButtonIndex = -1; // red
        actionSheet.CancelButtonIndex = 3;  // black
        actionSheet.Clicked += delegate(object a, UIButtonEventArgs b)
        {
            actionSheet.Dismissed += (object aSender, UIButtonEventArgs dismissArgs) => 
            {
                switch (dismissArgs.ButtonIndex)
                {
                    case 0:
                        showCamera ();
                        break;
                    case 1:
                        showPhotoLibrary ();
                        break;
                }
            };
        };
        actionSheet.ShowInView (view);
    };
    

提交回复
热议问题