I have an application working on the following envirnoment:
- Monotouch 2.1
- MonoDevelop 2.4.2
- MacOS 10.6.8
- iOS SDK 4.3
The same application, migrated to iOS 5.0/5.1 and Monotouch 5.2.10 with MonoDevelop 2.8.8.4 under, has the following problem: When i click a button to navigate in a UIWebView do not work.
Code is that:(obviously it's same in Monotouch 2.1)
public void ScrollToTop (object sender, EventArgs evt)
{
webView.EvaluateJavascript("window.scrollTo(0,0)");
}
What could i do?
SOLVED (with Jonathan.Peppers help):
public void ScrollToTop (object sender, EventArgs evt)
{
if((UIDevice.CurrentDevice.CheckVersion(5, 0)){
System.Drawing.PointF p = new System.Drawing.PointF(0, 0);
webView.ScrollView.SetContentOffset(p,true);
}
else{
webView.EvaluateJavascript("window.scrollTo(0,0)");
}
}
i have made in that way because on 4.3 webView.ScrollView.SetContentOffset make application crash.