Instagram Profile UIView structure - ios

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.

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.

Xcode UITableView image does not align properly on simulator

I am working on a project on Xcode7.3 using swift using autolayout. I am stuck with an problem with the UITableview not displaying properly on the simulator.
I created a ViewController and dragged a TableView into ViewController. Then I dragged a UIView and UIImage ontop of that TableView (To display as a header image). I also dragged a UIImage onto the prototype cell. They are all aligned in the center horizontally and vertically. However, when I run the app, they don't show in the middle of the screen.
As shown in the UITableView_Problem Image, the images are offset to the right. What is also weird is that when I rotate the screen, the scrollbar on the right does not go all the way to the right. The images appears to be in the center of the screen if I consider where the scroll bar is the end of the screen. But that doesnt make sense because the bottom bar items spans the full width of the screen.
However, if I create a UITableViewController from the story board instead of dragging a TableView onto a ViewController, I do not have a problem at all. (Image3)
It is frustrating because I wanted to add a text field for keyboard at the bottom of the screen just like the comment section in Instagram app. And after hours of searching, it appears that the only way to do that is to drag a tableView onto a ViewController. i stack imgur com JC5Pw png
Could anyone please assist? Much appreciated
Blockquote
note: I dont have a developers account yet so I cant check on an actual device
You are designing your interface in the wRegular/hRegular (or universal) size class. You will need to be very good about your constraints or develop a layout for the wCompact/hRegular size class for iPhones in portrait mode. You can change this by selecting here the blue part on the bottom of your storyboard
Thanks Dan for your prompt response! I added constraints to everything except for the tableView. Dont know what I was thinking as I have been troubled by this bug for a few days. Everything works fine after the tableView constraints was set!

Working with UIScrollView and UICollectionView

In my project, I'm trying to do an app similar to Instagram where I can scroll endlessly on the images that I have inside my personal profile. While scrolling, the top portion of my profile details is above where the whole screen will be filled with my photos when continuously scrolling thru my photos.
I think the way to achieve this is using UIViewController and working with UIScrollView and UICollectionView. However, my issue here is how do I create a custom height of the UICollectionView or UIScrollView in order to show the proper or exact height of the View? As such, I do not want to see "white spaces" at the bottom, or "cut" pictures.
I've tried using let height = CGRectGetHeight(self.myCollectionView) to get the height, but it always return me with the height I fixed in my IB regardless the number of items I have.
Could someone share with me the structure how I should do it? Many thanks!

UIPageControl UIScrollView animated effect

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

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