c# - Open gallery in simulator on image tap -


i want open gallery in iphone simulator upon button click. using xamarin forms - xaml create pages , image views.

what have implemented far : have galleryservice specific ios implements igalleryservice has method selectimage. selectimage creates uiimagepickercontroller _imagepicker.

in ios specific apps, do

 navigationcontroller.presentmodalviewcontroller(_imagepicker, true); 

but how similar using navigation in xamarin forms?

ps: have created view in .xaml file , move across pages in xaml.cs file

navigation.pushmodalasync(page) 

here, page must contain _imagepicker view, right? how that? kindly correct me if wrong.

xamarin.forms utilises single navigationcontroller on ios host different pages. of xamarin content pages navigation happens internally in xf, inside single main navigationcontroller.

you cannot mix other native view controllers inside navigationpage stack. can use native code , treat 1 navigationcontroller forms uses single "screen".

inside ios native project, can use

var topcontroller = uiapplication.sharedapplication.keywindow.rootviewcontroller; while (topcontroller.presentedviewcontroller != null) {     topcontroller = topcontroller.presentedviewcontroller; } topcontroller.presentviewcontroller (_imagepicker, true, null); 

to access xf's view controller, find top 1 , use in "native" ios app present modal view.

note rootviewcontroller null until "loadapplication" finishes, make sure calls made after that, should case if triggering action running app , not on startup.

if using pcl's, need form of dependencyservice trigger call shared code, , might need bit more logic in native app result shared code. need reimplement on other platforms might targeting app (such android or uwp).


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -