I'm creating some web/native hybrid iOS App with some C# background task on MonoTouch.
For a starter, I tried to create very simple webView sample referring
- http://docs.xamarin.com/recipes/ios/content_controls/web_view/load_local_content/
- http://docs.xamarin.com/recipes/ios/content_controls/web_view/load_local_content/Resources/Loading_Local_Content_(WebView).zip
(The above sample project code works, but I just need a webView without NavigatorView) and
My code so far is:
AppDelegate.cs
using System;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
namespace iostest
{
[Register ("AppDelegate")]
public partial class AppDelegate : UIApplicationDelegate
{
UIWindow window;
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
// create a new window instance based on the screen size
window = new UIWindow (UIScreen.MainScreen.Bounds);
window.RootViewController = new WebViewController();
// make the window visible
window.MakeKeyAndVisible ();
return true;
}
}
}
WebViewController.cs
using System;
using System.IO;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
namespace iostest
{
public class WebViewController : UIViewController {
UIWebView webView;
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
Console.WriteLine ("WebView Launched"); //this works
webView = new UIWebView(View.Bounds);
webView.ScalesPageToFit = false;
webView.LoadRequest (new NSUrlRequest
(new NSUrl (Path.Combine(NSBundle.MainBundle.BundlePath,
"www/app.html"), false)));
this.View.AddSubview(webView);
}
}
}
This code runs without an error, but results with only a blank white page, without showing my HTML content "www/app.html" (or, "http://google.com" whatever).
I don't see what logic I miss. Any thought? Thanks.