Author Topic: using gestures on a UIWebView?  (Read 1388 times)

Chris230291

  • Full Member
  • ***
  • Posts: 172
  • Reputation: 3
  • Computers: MacBook Pro, Hackintosh
  • iDevices: iPhone 4
using gestures on a UIWebView?
« on: November 24, 2011, 11:49:26 am »
hi. so i have a UIWebView app that loads a site, but i have no toolbars ect. instead i want a one finger swipe (left and right) to go forwards and backwards. so i drag 2 swipe gesture recogniser objects into the interface builder. i then click and drag them to the UIWebView and select an action. i then set the number of fingers and direction. sorted... or so i thought.

when i run the app the gestures dont recognise. my guess (as a complete beginner) is that it doesn't work because the one finger slide gestures are already used in the UIWebView (though they are NOT required, just scrolling up and down). so what can i do to accomplish my goal? do i need to disable the gestures in the webview somehow?

what are my options?

Thanks in advance,
Chris

brogan20

  • Hero Member
  • *****
  • Posts: 1061
  • Reputation: 3
  • My insides are full of human amazingness
  • Computers: Windows7 Vista
  • iDevices: iPod 4 gen iOS 5.0.1
Re: using gestures on a UIWebView?
« Reply #1 on: November 24, 2011, 10:18:46 pm »
reinstall it and see if that fixes it

8BitAce

  • Hero Member
  • *****
  • Posts: 703
  • Reputation: 57
  • If at first you don't succeed; call it version 1.0
  • Computers: Toshiba L505D-GS6000
  • iDevices: iPad 2 16GB WiFi, iPod 2g, iPod 4g
Re: using gestures on a UIWebView?
« Reply #2 on: November 24, 2011, 11:46:24 pm »
I'm not really familiar to using Xcode (I usually just code by hand) but did you add the code for your action method? i.e. Your
Code: [Select]
- (IBAction)... method.

Chris230291

  • Full Member
  • ***
  • Posts: 172
  • Reputation: 3
  • Computers: MacBook Pro, Hackintosh
  • iDevices: iPhone 4
Re: using gestures on a UIWebView?
« Reply #3 on: November 25, 2011, 11:25:48 am »
arh? i wasn't aware i had to? you see there are preset actions when working with the UIWebView (forward,backward, stop and refresh ect). instead of linking a button to a action, i linked the slide gesture.

someone said that i could try to subclass UIWebview and override this behaviour. but i dont know how to do that. (assuming this is caused by the 1 finger swipe already being part of the UIwWebView)

maybe this screenshot will help understand?



Thanks for your time.

« Last Edit: November 25, 2011, 11:31:09 am by Chris230291 »

Chris230291

  • Full Member
  • ***
  • Posts: 172
  • Reputation: 3
  • Computers: MacBook Pro, Hackintosh
  • iDevices: iPhone 4
Re: using gestures on a UIWebView?
« Reply #4 on: November 25, 2011, 12:03:21 pm »
i've learnt that this will disable scrolling, but i only want to disable left/right scrolling

 
Code: [Select]
[[webView subviews] lastObject] setScrollEnabled:NO];

Don't like seeing ads? Click here to register!

Chris230291

  • Full Member
  • ***
  • Posts: 172
  • Reputation: 3
  • Computers: MacBook Pro, Hackintosh
  • iDevices: iPhone 4
Re: using gestures on a UIWebView?
« Reply #5 on: November 25, 2011, 01:34:27 pm »
OK i've figured it out and boy do i feel like a spesh! it was just some checkboxes i needed to have a play with.
one thing though, when i build the app and transfer it over my home network to my macbook for syncing with my iphone, it doesn't work right on my device. however, when i choose my device to build and run on in xcode, it runs great!.

why? :S
i think i need to fix this issue so i can upload a copy to cydia.

Thanks
Chris

8BitAce

  • Hero Member
  • *****
  • Posts: 703
  • Reputation: 57
  • If at first you don't succeed; call it version 1.0
  • Computers: Toshiba L505D-GS6000
  • iDevices: iPad 2 16GB WiFi, iPod 2g, iPod 4g
Re: using gestures on a UIWebView?
« Reply #6 on: November 25, 2011, 11:10:06 pm »
Nice! Glad you figured it out!

As for the other issue, its probably not getting signed correctly or something. Do you have a developer account (as in paid $99)? Otherwise you may need to look into fake codesigning. How exactly does it act when it isn't working?

Chris230291

  • Full Member
  • ***
  • Posts: 172
  • Reputation: 3
  • Computers: MacBook Pro, Hackintosh
  • iDevices: iPhone 4
Re: using gestures on a UIWebView?
« Reply #7 on: November 26, 2011, 09:38:38 am »
it works now lol. i just transferred it over again a few times. something must have gotten corrupt in the process.
now I've got a fully working app, i think i wanna add fancy stuff like animations before i release 1.0.

is it possible to add the curling page animations to the forward/backward controls in a UIWebView? so with the gestures you flick through like a book.