I have made a simple web browser for the iPhone but I would really like to be able to pinch to zoom in and out with the UIPinchGestureRecognizer, but I don't know how to use it. Could someone explain to me how to implement it in my code? If you have a link to a good explanation of this that would be very much appreciated as well.
Why do you need to implement it at all? UIWebView already supports pinch-zooming natively.
For all the stuff you need for gesture recognizer's, look here. Basically, you set up a gesture for your view, and add a selector method that would get called if the view recognizes that gesture. In this case, when it detects a pinch, you would tell the view to change size to your liking.
This, however, is the hard way of doing it though, as the pinch gesture is already associated with a UIWebView (not to mention, the MKMapView as well). You should probably look at this other post to see what you need to do. Any search on google will also point you in the right direction. Hope that helps!
Related
Does anyone know how CNN is doing their top pull down menu?
It looks like a UITableView that is called with a touch drag event but wasn't sure. Googled various keywords but was not able to turn anything up. Just looking for some guidance on how to replicate this behavior.
I've no idea how it's actually done, but I know how I would do it: any view can sit completely or partially offscreen and be dragged onscreen by the user in the usual ways (e.g. a swipe or pan gesture recognizer). There's nothing special about that.
I guess they are doing something like https://github.com/mikefrederick/MFSideMenu
You have to customize "MFSideMenu" a lot though. If you dont want to show this menu on every view you need to disable UIGestureRecognizerDelegate on that view.
There is also something like https://www.cocoacontrols.com/controls/pullableview but you may need to add UIGestureRecognizer to this class.
I am looking to create my own gestures for my iPad app. I know this can be done but don't know where to start. I read that there is some sample code that can store your custom gestures so you can re use them. Think it was as ajson
I'm looking to draw numbers as custom gestures but any sample code/tutorial where I can get an idea where to start I would be very great full!
Thanks ahead.
The best place to start would be the Event Handling Guide for iOS section on Gesture Recognizers. There's a lot of information there on the different types of gesture recognizers. This should give you enough information on how to create the recognizer(s) that best fits your scenario.
I am curious as to whether or not there is an open source solution to replicate the flash button in the iOS camera applicaiton.
I have seem many other apps use this, but there doesn't seem to be a native way, so I assume there is a common source out there.
It is possible to get the flash button by using UIImagePickerController class, but most of the camera apps out there don't seem to be using this (or perhaps they subclass it, which is against apple's terms).
I am looking for a way to replicate the expanding behavior of the button. Any thoughts?
It doesn't sound too hard.
The way I'd do it is to separate the right curve of the button (as images), and make a UIView that has the left part of the button and the right curve as subviews.
When it's tapped, slide the right curve and animate the extra buttons in.
You could use a stretchable UIImage (see UIImage documentation) and then just animate the frame changing.
In the Apple 2010 WWDC Sample code (downloadable via iTunes, otherwise I'd post it here), there are several sample applications which use this control. They call the class ExpandyButton. I realize I'm answering my question, but hopefully someone out there can find this useful.
While looking for a similar solution to this problem I came across this code which was extremely helpful. Similar to ExpandyButton it fit my needs better.
https://github.com/ddebin/DDExpandableButton
I've been reading about how to support the zooming for a webview, and i've found a lot of resources. And now i'm really lost.
What i've read:
all you need is to enable the 'scales
page to fit'
add the uiwebview inside a
uiscrollview (while setting the
minimum/maximum zoom scale and
implementing - (UIView
*)viewForZoomingInScrollView:(UIScrollView
*)scrollView)
then you might need to handle the
touchdown events... manually
then you might have to
recognize them... manually... or
using a gesture recognizer.
And apple documentation doesn't really help, and i can't really tell which ios are they talking about?
I'm really lost now.
So if some veteran in coco-touch (which is very rare to find) can guide us.
Do i need a uiscrollview?
What do i really need to implement?
When would i need to capture touches
events, recognize the gestures, and
the zooming work.
And which is required in approximately which ios. Maybe this topic will help me and other people like me.
Thanks a lot in advance
Just enabling scalesPageToFit should do it; however, it's only possible to zoom to 100%, which also means that you can't zoom a page which is less than or equal to the screen size to begin with.
I'm taking a look at this widget, and it appears to be a UIPickerView, however I haven't seen anything provided by the iPhone SDK API that allows for horizontal scrolling only. Mostly it's all done vertically. Also there appears to be a custom graphic around this picker, so it might not be that either.
I'm curious if anyone is able to determine if this is indeed a UIPickerView or perhaps a hacked up UIScrollView? The widget is handy -- and I like its use. I found it in some random groceries app in the app store.
Here is the screenshot:
Thanks all.
I'd definitely use iCarousel library:
https://github.com/nicklockwood/iCarousel
The library is really well documented, the code is clean and maintained.
That is totally custom. You could indeed do something of the sort overlaying an UIImageView and an UIScrollView. I'd guess it's a 100% custom. As with all programming, there are many ways to do any single thing.
As I recently posted in response to this question, a class for an iOS horizontal picker control (STHorizontalPicker) has just been posted on GitHub. It's nowhere near as sophisticated as UIPickerView, but it provides the basic functionality for picking numeric values and the underlying foundation is probably a good starting point for adding more sophisticated functionality (it's a UIScrollView containing a UIView with multiple CATextLayers for the markers).
It was designed to be used in UITableCellViews and currently looks like this:
This website has source code for a picker that is aligned horizontally without subclassing it.
That definitely looks like a custom component. I'd suggest getting the .app file off your iPhone, opening up the bundle, and looking to see if there's a xib file for that interface. You may get lucky and find the component sitting in there. My guess is that it's a subclass of UIScrollView, but of course there's no way I could be sure of that without personally knowing the developer or the codebase.
You will recognize pickers by their giant screen-gobbling footprint :-) This is most likely a horizontal UIScrollView with a series of fixed-width labels (or images). The tricky bit is to have the bezel on top with a transparent center pass touches back to the underlying scroll view. Or you can take the easy way out and overlay four image strips (for each edge) and leave the middle open so touch events go directly to the scroller.
It's a custom control, but it's really not that hard to build.