Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 10-21-2010, 10:43 PM   #26 (permalink)
Registered Member
 
Join Date: Jan 2010
Location: Beech Mountain, NC
Posts: 3
jtrue is on a distinguished road
Default Huzzah!

Quote:
Originally Posted by kornienkos View Post
[[[bioWebView subviews] lastObject] setScrollEnabled:NO];

works for me
One line is all it took for me. I put it in my viewDidLoad in my ViewController class. I tried the javascript but it only worked on certain pages. also, any page with embedded div content or iframes or dynamic javascript was preventing the javascript fix from working.


[[[myWebLabel subviews] lastObject] setScrollEnabled:NO];
jtrue is offline   Reply With Quote
Old 11-18-2010, 09:05 AM   #27 (permalink)
Registered Member
 
Join Date: Nov 2010
Posts: 2
TieAetsch is on a distinguished road
Default Stop scrolling in UIWebView

Hi everyone,

read this thread, because I had the same problems with the UIWebView.

Since some approaches posted here did not work out for me, I took another (closer) look at the API.

YES, UIWebView does not inherit from UIScrollView.

BUT! It does conform to the UIScrollViewDelegate

Which means, you can inherit UIWebView and override
- (void)scrollViewWillBeginDragging: (UIScrollView *)scrollView

in this way:

Code:
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView{

	scrollView.scrollEnabled = NO;
}
That's it. No "subviews last index" and so on...

Worked pretty fine for me and I doubt that it will be rejected by Apple.

Rock on!

TH
TieAetsch is offline   Reply With Quote
Old 12-28-2010, 03:00 PM   #28 (permalink)
Registered Member
 
Join Date: Dec 2010
Posts: 2
S21Mi is on a distinguished road
Lightbulb

Hey,

anybody try

Code:
[(UIScrollView *) [webView6.subviews objectAtIndex:0] setAlwaysBounceVertical:NO];
worked for me
S21Mi is offline   Reply With Quote
Old 01-03-2011, 06:40 AM   #29 (permalink)
Mobile Application Dev.
 
Join Date: Oct 2008
Location: Bangalore, india
Posts: 362
mpramodjain is on a distinguished road
Default

Quote:
Originally Posted by S21Mi View Post
Hey,

anybody try

Code:
[(UIScrollView *) [webView6.subviews objectAtIndex:0] setAlwaysBounceVertical:NO];
worked for me
Worked great.
Seems UIScrollView is first subview of UIWebView.






oooooooops !!!!!!! :-) krashing on below iPhone 4.1 OS.. any other way

Last edited by mpramodjain; 01-04-2011 at 03:28 AM. Reason: Crashing in below 4.1
mpramodjain is offline   Reply With Quote
Old 01-13-2011, 10:45 AM   #30 (permalink)
Registered Member
 
Join Date: Nov 2010
Posts: 2
TieAetsch is on a distinguished road
Default

Implementing the delegate Method worked in 95% for me,

since the WebView did scroll some pixels and did top then...

here is my updated solution:

Code:
- (id) initWithFrame:(CGRect)frame{
	
	if (self = [super initWithFrame:frame]) {
		
		for (unsigned i = 0; i < [[self subviews] count]; i++) {
			
			if ([[[self subviews] objectAtIndex:i] class] == [UIScrollView class]) {
				
				UIScrollView *scrollView = (UIScrollView*) [[self subviews] objectAtIndex:i];
				
				[scrollView setScrollEnabled:NO];
			}
		}
	}
		
	return self;
}
Subclassing WebView and then loop through all subViews, if it is a ScrollView, disable it. So I don't mind on which position of the subview array the scrollView is.
TieAetsch is offline   Reply With Quote
Old 01-13-2011, 10:47 AM   #31 (permalink)
Nuisance Developer
 
Join Date: Jul 2009
Location: Italy
Posts: 4,691
dany_dev is on a distinguished road
Default

ahahaha cool way to do it.
__________________
dany_dev is offline   Reply With Quote
Old 01-18-2011, 04:40 AM   #32 (permalink)
Mobile Application Dev.
 
Join Date: Oct 2008
Location: Bangalore, india
Posts: 362
mpramodjain is on a distinguished road
Default

Quote:
Originally Posted by dany88 View Post
ahahaha cool way to do it.
does it work on all Iphone OS . I mean from 3.0 to the latest iOS versions.
mpramodjain is offline   Reply With Quote
Old 04-27-2011, 08:17 AM   #33 (permalink)
Registered Member
 
Join Date: Apr 2011
Posts: 1
namit.nayak is on a distinguished road
Default

Thanks Nice One its Working...
namit.nayak is offline   Reply With Quote
Old 05-23-2011, 07:41 PM   #34 (permalink)
Registered Member
 
Join Date: May 2011
Posts: 1
farhad_m is on a distinguished road
Default

Why do all these sub classing and hacks? Put this function in your interface and call it:

Code:
-(void)disableScrollingOnWebView:(UIWebView*)webView
{
	for(id sub in [webView subviews]
	{
		if([sub isKindOfClass:[UIScrollView class]]
		{
			[sub setScrollEnabled:NO];
		}
	}
}
i.e.
Code:
[self disableScrollingOnWebView:myWebView];

- Farhad
farhad_m is offline   Reply With Quote
Old 05-24-2011, 02:22 AM   #35 (permalink)
Nuisance Developer
 
Join Date: Jul 2009
Location: Italy
Posts: 4,691
dany_dev is on a distinguished road
Default

that is the same thing posted by TieAetsch....

yes, he used it in init, but the idea was the same
__________________
dany_dev is offline   Reply With Quote
Old 07-01-2011, 02:33 PM   #36 (permalink)
Registered Member
 
Join Date: Jul 2011
Posts: 1
pbamma is on a distinguished road
Default This javascript works

Quote:
Originally Posted by MrMidi View Post
Greetings,

Code:
document.onload = function(){
    document.ontouchmove = function(e){ e.preventDefault(); }
};
Enjoy,

- Peter Schmalfeldt
Thanks, the javascript does indeed work and prevents scrolling up/down completely. Unfortunately for the work I'm doing, I do need it to scroll but not bounce (or show the grey-ish top/bottom bounce indicator bars). I'll need to find a different solution than the javascript.
pbamma is offline   Reply With Quote
Old 07-01-2011, 02:51 PM   #37 (permalink)
Nuisance Developer
 
Join Date: Jul 2009
Location: Italy
Posts: 4,691
dany_dev is on a distinguished road
Default

Quote:
Originally Posted by pbamma View Post
Thanks, the javascript does indeed work and prevents scrolling up/down completely. Unfortunately for the work I'm doing, I do need it to scroll but not bounce (or show the grey-ish top/bottom bounce indicator bars). I'll need to find a different solution than the javascript.


Code:
-(void)disableBouncesOnWebView:(UIWebView*)webView
{
	for(id sub in [webView subviews])
        {
            if([sub isKindOfClass:[UIScrollView class]])
               {
                   UIScrollView *scrollView = (UIScrollView*)sub;
                   [scrollView setBounces:NO];
               }
        }
}
__________________

Last edited by dany_dev; 12-14-2011 at 04:25 AM.
dany_dev is offline   Reply With Quote
Old 08-27-2011, 06:37 PM   #38 (permalink)
Registered Member
 
Join Date: Aug 2011
Posts: 1
ColinX is on a distinguished road
Default I Prefer the Simple Answer

You could get really crazy and do this,

[webView setUserInteractionEnabled:NO];
ColinX is offline   Reply With Quote
Old 08-28-2011, 03:22 AM   #39 (permalink)
Nuisance Developer
 
Join Date: Jul 2009
Location: Italy
Posts: 4,691
dany_dev is on a distinguished road
Default

Quote:
Originally Posted by ColinX View Post
You could get really crazy and do this,

[webView setUserInteractionEnabled:NO];
that is not what we want to achieve....
__________________
dany_dev is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to show "Turn off Airplane Mode..." network dialog? bonehead iPhone SDK Development 8 01-18-2010 10:37 PM
Beta 8 - Tab Bar Application with UIWebView Marco iPhone SDK Development 7 06-02-2009 11:37 PM
UIWebView tkilmer iPhone SDK Development 3 08-15-2008 10:15 AM
UIWebView keyboard Fastrak iPhone SDK Development 1 06-19-2008 04:21 PM
UIWebView autoscaling Fastrak iPhone SDK Development 0 05-03-2008 10:30 AM


» Advertisements
» Online Users: 385
11 members and 374 guests
chiataytuday, chits12345, ChrisYates, fiftysixty, fredidf, gmarro, KennyChong, Leslie80, Meoz, ryantcb, Yosh_K
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,670
Threads: 94,121
Posts: 402,903
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Yosh_K
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 04:28 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0