Last active
March 13, 2017 14:06
-
-
Save rudyryk/6210c53281c3548793d2e8da3281311b to your computer and use it in GitHub Desktop.
Xamarin.Forms / C# — Custom modal page transition for iOS via setting the ModalTransitionStyle property
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// MyPageRenderer.cs | |
// | |
// No Rights Reserved | |
// http://creativecommons.org/publicdomain/zero/1.0/ | |
// | |
// Define custom Xamarin.Forms renderer for iOS platform | |
// for page you want to show as modal. View controller | |
// for the page is wrapped into internal Xamarin.Forms | |
// wrapper class and we can access it as parent. | |
// | |
using System; | |
using Xamarin.Forms; | |
using Xamarin.Forms.Platform.iOS; | |
using UIKit; | |
using Project.Portable; | |
using Project.iOS; | |
[assembly: ExportRenderer (typeof (MyPage), typeof (MyPageRenderer))] | |
namespace Project.iOS | |
{ | |
public class MyPageRenderer : PageRenderer | |
{ | |
public override void DidMoveToParentViewController (UIViewController parent) | |
{ | |
base.DidMoveToParentViewController (parent); | |
parent.ModalTransitionStyle = UIModalTransitionStyle.CrossDissolve; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment