UIPageControl UIScrollView animated effect - ios

I'd like to be able to swipe the screen to the left and right to display different user details (see link to screenshot below). I'd also like the animated effect where you see the items leave the screen on one side and the new items appear from the opposite side.
Elements used on storyboard.
UIViewController
UIImageView
UILabel x 3
UIPageControl
For starters, I don't know which elements I need to get this effect. I'm looking for someone to tell me what elements I need and sample code to go with it.
Screenshot of my ViewController - http://oi60.tinypic.com/k3roqp.jpg
I do not want to use UIPageViewController

You can use either a UIScrollView with paging enabled or a UIPageViewController to display multiple view controllers as pages. There are plenty tutorials on the web for those.
You can find documentation for those controls directly at Apples website:
UIScrollView: https://developer.apple.com/library/ios/documentation/uikit/reference/uiscrollview_class/Reference/UIScrollView.html
UIPageViewController: https://developer.apple.com/library/ios/documentation/uikit/reference/UIPageViewControllerClassReferenceClassRef/UIPageViewControllerClassReference.html

Related

Custom Page Control with Paging Scrollview

Instead of the standard dots that Apple provides for a page control, I want to have something like this. However I don't want it to be in an infinite loop were you can circle around. All I care about is the scrollable text on top, not the parallax image.
Currently I have a paging scrollview that contains three view controllers so my custom page control will have only three words: Main, Today, Settings.
The way I see this being built is the following:
Subclass UIView and insert three UIButton's and evenly space them. The title of the buttons will be Main, Today, Settings.
Insert this UIView as child of scrollview (or maybe not)
Make UIView the width of the iPhone screen
Not sure about here now -> as you scroll the scrollview shift the UIView on and off the screen so that the UIButton will be centered in one of the view controllers in the scrollview.
Am I on right track or does anyone have a demo to this?
Yes. You are on right track. You can use scrollView for this exact purpose. You have to make use of scrollViewDelegate methods for this. The below link will explain you how to do that.
How to make Paging with scrollView.

Instagram Profile UIView structure

I'm trying to create an Instragram profile page-like view in iOS swift, but I don't know what and how you should go about making one! So, I'm guess you should use UIScrollView in the ProfileViewController, and embed UICollectionView for the pictures. But, isn't UICollectionView itself a subclass of UIScrollView? As far as I know, overlapping two scrollView is not a good practice.. Any recommendation? I want to have a profile picture on the top with name and caption right underneath the profile picture. And, a collection of pictures(column: 3) on the lower portion of the ViewController. Number of pictures are variable, so I need the ViewController scrollable.

How do I create a custom UIView that slides down or up from behind a UINavBar depending on scroll direction in objective-c?

Currently building a store app. I have a collection view that displays clothing images with their prices and title. I'd like users to be able to filter and refine results and change the layout of the page using a special bar that will slide down and plot itself just underneath the UINavBar.
This is what I want to do:
User starts to scroll down.
Slide down nav bar sized custom view at desired speed from behind UINavBar.
User starts to scroll back up
Slide up nav bar sized custom view at desired speed from behind UINavBar.
Custom view should be opaque
Custom view shouldn't effect the controller view and sit on top of it when visible.
Part of my hierarchy:
UINavigationController -> UIViewController -> UICollectionViewController
All above will be taking place in my UICollectionViewController.
Futher info:
Since this is something I'd be doing often I'd like to learn and understand how to do this properly, however I don't mind using ready made solutions.
Image below may help..
I look forward to you responses.
Kind regards
Adding a basic pull down here is very easy steps.
I have used here in this example a UIToolbar to slide in & out
UPDATED
The video mentioned here is updated today with added colours to the slideIn toolbar.
UPDATED : 1
kindly try the GTScrollNavigationBar as described here in this post of stackOverflow.
Another option could be to add a UIPanGestureRecognizer on the scroll view. You could use the translationInView method to know how much distance to move your view.
First, it would be better that you change your view hierarchy to
UINavigationController -> UIViewController-> UICollectionView & custom view
In your current code, have you added the collection view as a cell in the tableview?
Well, since the collection view is inherently scrollable, this is not necessary.
besides, if you add your custom view to the tableview or the collection view, the custom view will scroll alongside with the scrollable view, which, i bet, is not what you want.
so what you may do is to:
1. add the `custom view` to the view of the `UIViewController`
2. add also the `collection view` to the `UIViewController`
3. implement `UICollectionViewDelegate`, `UICollectionViewDataSource` for the `UIViewController`
4. implement 'scrollViewDidScroll' in 'UIScrollViewDelegate' for the `UIViewController` to detect scroll action
5. get scroll direction as indicated here:
Finding the direction of scrolling in a UIScrollView?
6. when a scroll is detected, set the desired frame of your custom view in [UIView animateWithDuration:animations:], and adjust speed by adjusting the duration of the animation.
7. Done!
well, just in case.... you can set the origin of the frame as negative to move the custom view outside the view of the UIViewController

Elusive UIView Subclass Name

This one is really bugging me! What is the name of this UIView subclass? I'm not talking about the compass itself, but the two dots at the bottom of the view. I know it's not a private API because I have seen it before. Or am I confused and this is not a UIView at all, but a UIViewController. Which UIView / UIViewController subclass is shown here. It acts like a UIScrollView, but has distinct pages, and has the dots at the bottom of the screen that show the users relative progress through the pages. I have checked this link about UIView subclasses, but became lost after about the 45th one. http://www.themusingsofalostprogrammer.com/2010/09/list-of-every-uiview-subclass.html
(source: tqn.com)
Thankyou for your time.
It is a UIPageControl. It corresponds (or is supposed to correspond) to the number of "pages" the user can scroll to, sideways. Normally, it indicates how many pages there are, and which one we are on, plus it typically provides a way to scroll sideways (by tapping to its left or right).
If I may add to what matt said...
To use a UIPageControl effectively, you also need a UIScrollView that contains the content. An update to the page control should result in a change to the contentOffset of the scrollView as shown in the code below. UIScrollView has a pagingEnabled property that should be set to YES to complete the illusion of paging.
- (IBAction)pageValueChanged:(UIPageControl *)sender
{
// self.pagedView is an IBOutlet to a UIScrollView
[self.pagedView setContentOffset:CGPointMake( sender.currentPage * 320, 0 ) animated:YES];
}

Simple Picture based App

I'm developing a iPad app which is just a series of pictures, and I'm stuck. I've managed to link up a Tab Bar Contoller to the 6 View Controllers and all seems to work well. But I'd like to be able swipe to the next View Controller once the user has selected the button. How do I do this? The swipe gestures don't work for me. Here's a snapshot:
I think you are looking for UIPageController. This is the control that is used in the iPhone Weather app to allow you to swipe from city to city. Go here to see the full documentation on the control.
That's not usually how Tab Bars work in iOS, but…
What it sounds like you're after is either a UIScrollView with paging enabled (keep in mind you'll have to set the scroll view's ContentSize) or a UIPageViewController (if you don't want to deal with sizing explicitly and you're OK making a new UIViewController to house each image). I'd recommend the first option. The process would go something like:
Add the UIScrollView as a subview of your main view (remember, ensure to set pagingEnabled to YES
Add each image to the scroll view
Set the scroll view's content size to the total width of all images
Thanks for the clarification!

Resources