How to access the scrollview inside an UIWebView
Every UIWebView contains a scrollview, so if anybody wants to access that scrollview he/she can do this by following way.
if( [self.webView respondsToSelector:@selec tor(scrollView)] ) {
UIScrollView *sv = [self.webView performSelector:@selector (scrollView)];
[sv setDecelerationRate:UIScr ollViewDecelerationRateNo rmal ];
for( UIImageView *innerView in sv.subviews ) {
if( [innerView isKindOfClass:[UIImageVie w class]] ) {
innerView.hidden = YES;
}
}
NSLog(@"ios 5+");
}
else
{
NSLog(@"ios 4");
for( UIScrollView *view in [self.webView subviews] ) {
if( [view isKindOfClass:[UIScrollVi ew class]] ) {
[view setDecelerationRate:UIScr ollViewDecelerationRateNo rmal];//0.998000
for( UIImageView *innerView in [view subviews] ) {
if( [innerView isKindOfClass:[UIImageVie w class]] ) {
innerView.hidden = YES;
}
}
}
}
}
if( [self.webView respondsToSelector:@selec
UIScrollView *sv = [self.webView performSelector:@selector
[sv setDecelerationRate:UIScr
for( UIImageView *innerView in sv.subviews ) {
if( [innerView isKindOfClass:[UIImageVie
innerView.hidden = YES;
}
}
NSLog(@"ios 5+");
}
else
{
NSLog(@"ios 4");
for( UIScrollView *view in [self.webView subviews] ) {
if( [view isKindOfClass:[UIScrollVi
[view setDecelerationRate:UIScr
for( UIImageView *innerView in [view subviews] ) {
if( [innerView isKindOfClass:[UIImageVie
innerView.hidden = YES;
}
}
}
}
}
No comments:
Post a Comment