blob: 07da048ad87204cdba6760024b83c2a518360dbf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
using System;
#if __UNIFIED__
using UIKit;
#else
using MonoTouch.UIKit;
#endif
namespace Xamarin.Forms
{
public static class PageExtensions
{
public static UIViewController CreateViewController(this Page view)
{
if (!Forms.IsInitialized)
throw new InvalidOperationException("call Forms.Init() before this");
if (!(view.RealParent is Application))
{
Application app = new DefaultApplication();
app.MainPage = view;
}
var result = new Platform.iOS.Platform();
result.SetPage(view);
return result.ViewController;
}
class DefaultApplication : Application
{
}
}
}
|