I have a simple iOS app (running on iPad) that has only an UIWebView filling the full screen.
Now I added a new UIWebView(a lot smaller that the previous one) and let it sit on top of the first one.
Is there a way for me to be able to drag and drop the second UIWebView around on the first one?
Thanks a lot
You can use a UIPanGestureRecognizer to add drag capabilities to any view. Using it, you will be given the coordinates of the drag (you can set the view's frame with this), and are given a flag when pan has stopped (your drop).
Here's an example taken from the web: Working with UIGestureRecognizers
Related
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!
This is the situation:
I got the two image view on top of the view, and on the bottom is a container view (the one with the segmented control) that can be dragged upward.
Now, is there a way to add a parallax effect to the background image (the one with the blur) as I drag the container upward?
A I can see you are working on iOS 9 so you can use InterploationMotionEffect available from iOS 8. I have also created example for the same ParallaxEffectExample
Example is in swift & having two example set. First one as manual & second one using InterploationMotionEffect in UITableView.
I am sure this is an easy question, but I am lost. I have MWPhotoBrowser and a bunch of photos loaded into the browser. Everything works beautifully, except if I click on an image in the browser and drag it around the screen it moves everywhere and repositions the image. Essentially I just want to stop if from dragging around all together.
Any recommendations ?
There were two issues causing this problem:
Autolayout was turned off. Since I wanted it to remain off I had to create a work around with #2.
The content appears to be sized to the View. In my case the view height was much larger than the available display area on the screen. To work around the issue I used another view sized to the viewable area and added the browser to that view rather than the super view.
I'm trying to replicate the Passbook.app UI, and can't seem to figure out the basic structure of the interface.
When you just have one pass loaded, you can drag a pass up, and it snaps back in place. You can drag the pass down, and it snaps back in place.
I've created a UIScrollView and added a subview (representing a pass). I set the scrollView's contentSize to be greater than the device screen, but I don't get any snapping; the pass just scrolls off or on the screen. Anything less than the device screen and no scrolling occurs at all.
Any ideas how they are getting that effect? Possibly using multiple UIScrollViews?
Update: I've created a sample of how this can be achieved using UICollectionView, I hope it helps you to go in the right direction.
I've been digging into this. I used Reveal to explore the view hierarchy. Basically it uses a UIScrollView with many UIScrollViews inside each of them connected to a UIDynamicAnimator.
Look for the headers here.
This is what I'm trying to do: I've got two mergDataGridScrollers on top of each other. If I turn one of them invisible and scroll the other, I'm scrolling the invisible scroller because 1) it's not scrolling the intended scroller and 2) I can see the scrollbar of the invisible scroller scrolling.
So, I tried dispatching a "closeControl" to the invisible scroller, but that did not get sent because I think the command is private. Any suggestions on how to work with two overlapping iOS scrollers?
I haven't used mergDataGridScrollers but have used scrollers in iOS with groups - and in an app where I wanted an iOS scroller to slide on and off the screen I had to delete it, slide off the group behind the scroller and slide the group on again and recreate the scroller when I wanted it back. Showing and hiding the scroller didn't cut it for me (as you describe on a device if you do a swipe where the scroller was you'll see the scrollbar) - you'll presumably have to delete and create the scrollers anyway on leaving/entering cards on iOS.
The problem is there's a couple of bugs in mergDataGridScroller... I'll try and get a new version up ASAP