I'm using Monotouch to develop an iPhone application. I'm aware there are answers out there for this question already for Objective-C. For example:
Stop UIWebView from bouncing vertically
This answer is ideal. I figured I could just take it, and turn it into C# and it'll be fine.
The Objective-C code is:
for (id subview in webView.subviews)
if ([[subview class] isSubclassOfClass: [UIScrollView class]])
((UIScrollView *)subview).bounces = NO;
I couldn't find anything similar to isSubclassOfClass:
in C# and after a little experimenting, I found my webView only contained one subview, which was a scrollview. So I tried the following C# code:
foreach (var view in webView.Subviews)
{
webView.Subviews[0].Bounces = false;
}
This should've worked except the returned type of webView.Subviews[0]
was type UIView
not UIScrollView
- this meant the compiler complains the UIView
doesn't have a property "bounces" (which is correct.)
So my question is, what would be the appropriate way of doing this? Is there a way I can get the UIScrollView instance from the subviews? Or am I going about this completely the wrong way?
Thanks.