Skip to content

Instantly share code, notes, and snippets.

@rudyryk
Last active March 13, 2017 14:06
Show Gist options
  • Save rudyryk/6210c53281c3548793d2e8da3281311b to your computer and use it in GitHub Desktop.
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
// 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