Swift : Create region to UIPanGesture - ios

I have this design here : http://imgur.com/XHMBUdj
I would like to allocate the left half of the screen(splitting vertically) to panning up and down for the blue bars and allocate the right half of the screen(splitting vertically) to panning up and down for the red bars.
I can already use UIPanGestureRecognizer, however, I just need help making the region in which if the user pans on the right side of the screen, "this" happens and if the user pans on the left side, "this" happens.
A friend of mine recommended using UIBezierPath. Could someone help me out? Code will be much appreciated!

I looks like it would be easier to have two UIPanGestureRecognizers.
In your view, you can add a subview that take up the left half on the screen that contains the blue bars and the microphone and add another subview that is on the right half of the screen containing the red bars and the music icon.
Then you can create two separate UIPanGestureRecognizers and add one to each of the views. Then each side will have its one recognizer that will take care of the side detection for you.

Related

Swift: How to drag image view to "snap" up against edge of the next image view

Using Swift 4 in XCode, I have several image views on the screen. I have added a gesture recognizer to one, and am able to move that image around the screen with a pan action.
What I'd like is that when I move that image NEXT to another image view on the screen, it "snaps" into place right next to it. (imagine magnetic lego blocks - and when one gets close to the next one, it snaps and attaches) -- as opposed to, say, being able to drag the movable image on TOP of the static image.
Can anyone guide me toward an answer, as I don't know what this concept is called.
(I'm not really trying to use animation, as it should only move based on a user's swipe.) Any tutorial links would be appreciated! Thanks!

Free Scrolling in Xcode 8.3.3

I want to create a page with a big image as background and buttons that users can interact with.
So imagine I put a big image such as a piece of map into the screen, but I only show a corner of the map in the display. So if a user wants to see other parts of the map, they have to "scroll" and navigate to wherever they want.
Meanwhile I also want to put a button they can tap on, and that button should lead to a php webpage (in-app, not opening in safari or else) or information page about sites and buildings in this location.
I am a rookie and I haven't have any code written down yet. I am thinking about using UIScrollView and UIButton, but am I on the right direction? Any advice?
Thanks in advance!
First you need a way to pinch zoom the image. In this mode, you can drag the image in any direction that you want. A common method can be found here. A scroll view can only scroll horizontally or vertically but with that image zooming, each image can be zoomed in and then dragged to any direction you want. You can have a scroll view with only one image.
After you have the image zooming ready, all you need to do is to create a subview on your screen to cover part of the image view or scroll view, whatever you used.

Guidance - Custom UICollectionView animation

I am looking for guidance with how to approach the following animation scenario.
I have UICollectionView with a custom circular UICollectionViewLayout subclassed layout. There are (circular) images around the perimeter of the circle and a 50% larger (circular) image in the center of the circle.
When the user taps one of the perimeter images, I want the tapped on image to move toward the center (becoming 50% bigger) and sort of "connect with" the center image. I then want the two images to float to the top of the view. (The bottom portion of the view will then be a context of things related to the two joined images).
If this makes sense to anyone, I'd really appreciate a starting point of some kind.
By the way, I'm an old developer but new to iOS and developing in Swift (but can read Objective-C).
Thanks!
I solved this using a visual trick. Of course, I'm sure there's a better way.
When one of the perimeter circles is tapped, I transition to a view controller that immediately creates a duplicate of the center circle and the tapped circle in their former locations, making it appear that the other elements disappeared.
I then simultaneously animate the tapped circle to the center and the center image to the top of the view. I enlarge the tapped circle briefly and then animate it to the top of the view next to the center circle restoring the tapped image's original size.
Not elegant but it works.

Draw animations dynamically (interactively) on MKMapView

I want to draw an animation over MKMapView. I want it to be something like a compass arrow, that follows (rotates) user's taps / swipes .
So the arrow goes from the center of the screen and is of a fixed length. I don't need the line to be coordinate-specific, but I need to keep the map interactions intact (i.e. still being able to pinch-zoom on the map).
I tried to do that via MKPolyline (creating and then destroying a line), but that does not work (and from the way I had to do that I feel like it won't work). I wonder what would be the best way to handle that? Quartz?
I would accept just an explanation (which kind of view overlay over what, which classes to use), no code is necessary (but if you have a working example that's so much better ))
I draw views like a map ruler not as subview from MkMapView. I put kMapView and my ruler view into a container view. This works for views which positions are fixed on screen, like on center of screen, and are not related to a geographical position.

Create a list/table of UIButtons

I want to recreate the list of UIButtons (that's what I think it is, at least) that can be seen all over the place, like in the Settings app:
They look like the standard UIButton, but where the top button does not have any corner radius on its bottom left and right corners, the same goes for the bottom button, and all buttons in the middle don't have any corner radius.
They might not even be buttons at all, maybe some kind of table view? I don't know. What are they and how do I add them to my app?
That's actually a UITableView in grouped style. Each of the "buttons" is a UITextViewCell. See http://developer.apple.com/library/ios/#documentation/uikit/reference/UITableView_Class/Reference/Reference.html for more info.

Resources