Disable bouncing edges in UIPageView - ios

I have a UIPageViewController which manages UINavigationControllers, which are hooked up to a UITableView. I want the user to be able to swipe between the different "table views", which currently works. When the user swipes on the first or last page, the controller moves off the screen and there is black behind it. I don't want the user to be able to swipe off the screen.
I tried using gesture recognizers to prevent pan and swipe gestures in a certain direction when the user was at the first or last page but when I returned NO in gestureRecognizer:shouldReceiveTouch: the view was still able to scroll.
In the end I am trying to emulate how "snapchat" works, I don't mind using a different method to achieve what they have I just am unsure how I would do it.

You can try setting background color on the superview to white or the color of your tableview.

I finally figured out an easy semi-fix. I decided to take a screenshot and use the clone tool to get rid of all the labels and I set it as the background image of the UIPageView. Now at least it doesn't look black, it just looks like the tableview continues off the screen.

Related

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.

UIScrollView with multiply controls doesnt scroll when trying to swipe from place where control exists

This is how my UIScrollView looks like:
Yellow mean intearctive controls. Once this controller is loaded, I try to swipe it up, but it lacks, i do not know why. When I try a few times, then it moves. Why it happens like that?
EDIT:
Actually it doesn't move when I try to swipe it from the place where yellow control exists.

How to swipe view up to reveal a menu at the bootom of the screen using Swift

I would like to create a toolbar/navigationbar that appears at the bottom of the screen when the user swipes up on the screen. I would like it to have a bit of resistance in the same way pull to refresh works at the top of a tableview. However I am not using a tableview in my app.
I have tried searching for anything that would point me in the right direction, however the search terms seem to return results either about swiping to delete or facebook style menus.
How would I achieve the swipe up to reveal? Any advice or links to helpful tutorials would be much appreciated
Thanks in advance
Add the menu view to the view but outside of the screen. Add a UIPangestureRecognizer to the view. In the action of the pan recognizer, change the frame of the menu view according to the pan distance.

UICollectionView Stacking

How can I stack cells (in a UICollectionView) on top of each other? Feedly does it quiet well and I was wondering if I can somehow manipulate the zIndex property to get a similar effect in navigation of a UICollectionView.
Or am I wasting my time with UICollectionViews and should be looking into changing my approach with perhaps a Container View Controller?
In order to accomplish this my team added a basic full page horizontal cover flow layout to a uicollectionview. We then added a pan gesture recognizer and disabled scrolling on the collectionView controller. As soon as the pan gesture starts we screen cap the cell and place the image over the collectionView. Once that is done we manually change the page of the collectionView to the next page behind the screenshot. We then animate the uiimage (the screen cap of the previous page) along the path of the gesture. If it goes past a threshold we commit the animation and remove the image and you get the full effect of a previewed collectionView cell.
Unfortunately the threshold checking is a bit tedious because you must revert. Also the animation for bringing a cell back is a little quirky. With this method if you don't add it as a special case then it looks the cell is always behind. Since we want it to look like a stack we made sure that it looks like you are pulling the previous cell from offscreen to the top of the stack. This is done by keeping a collection (NSArray) of cell screenshots that matches are data source so basically we can just grab the image based on indexPath.row. Do the pan gesture recognizer to bring it back on to the stack. If it passes the threshold we commit the animation and at the end change the current cell of the collection view and remove the screenshot. So it feels seamless.
There is really nice write up regarding this, jump onto this website and you will find everything you need.
http://skeuo.com/uicollectionview-custom-layout-tutorial
Basically what you are looking for is the CustomLayout.
You can use CHTCollectionViewWaterfallLayout to create pinterest-like-layout. It's created on top of UICollectionView.

Fluid full screen view transitions on iOS

I have a simple app that has a set of coloured views, one red, one green and one blue.
I am trying to make it so that when a swipe gesture is made the current view will switch to the next one in the list in a fluid manner, it looks like moving a long piece of paper with different colours on it.
Is there a way to do this (CoreAnimation)?
You could first look into UIScrollView. It seems to me that what you are trying to accomplish is the same you have, say, in Mobile Safari on an iPhone, when you show all your current pages and can go from one to the next by scrolling. This tutorial is particularly close to what you describe.
If you are looking into more advanced kind of transformations, than Core Animation would be the option.
Actually, nothing prevents using both approaches, UIScrollView to handle the swipe, Core Animation to add more animation to the pack...
You could use a UIScrollView to accomplish this. Add all of your colored views as subviews to the scroll view. Make sure your contentSize is setup appropriately and optionally setup paging to make the scrolling always snap to a certain border. See the scroll view programming guide for more info Scroll View Programming Guide

Resources