c# - How to use UIViewControllerTransitioningDelegate with MvxIosViewPresenter? -
i have view controller a
, view controller b
, want navigate a
b
(present modally) custom transition (uiviewcontrollertransitioningdelegate
), how mvxiosviewpresenter
?
do need write custom presenter myself or there way how in elegant way?
it possible use custom transition mvxiosviewpresenter
. have create custom uiviewcontrollertransitioningdelegate
, assign viewcontroller (viewdidload
place it).
something should work:
[mvxmodalpresentation(modalpresentationstyle = uimodalpresentationstyle.overfullscreen, modaltransitionstyle = uimodaltransitionstyle.crossdissolve)] public partial class modalview : mvxviewcontroller<modalviewmodel> { public modalview(intptr handle) : base(handle) { } public override void viewdidload() { base.viewdidload(); transitioningdelegate = new transitioningdelegate(); } } public class transitioningdelegate : uiviewcontrollertransitioningdelegate { public override iuiviewcontrolleranimatedtransitioning getanimationcontrollerforpresentedcontroller(uiviewcontroller presented, uiviewcontroller presenting, uiviewcontroller source) { return new customtransitionanimator(); } } public class customtransitionanimator : uiviewcontrolleranimatedtransitioning { public override double transitionduration(iuiviewcontrollercontexttransitioning transitioncontext) { return 1.0f; } public override void animatetransition(iuiviewcontrollercontexttransitioning transitioncontext) { var inview = transitioncontext.containerview; var tovc = transitioncontext.getviewcontrollerforkey(uitransitioncontext.toviewcontrollerkey); var toview = tovc.view; inview.addsubview(toview); var frame = toview.frame; toview.frame = cgrect.empty; uiview.animate(transitionduration(transitioncontext), () => { toview.frame = new cgrect(10, 10, frame.width - 20, frame.height - 20); }, () => { transitioncontext.completetransition(true); }); }
}
Comments
Post a Comment