How do I make my UIView scrollable horizontally programmatically using Objective-C? - ios

I have created nine table view controllers using page view controller and UIView. Inside UIView, there are nine buttons to points the table view controller.
My problem is, I want to make my UIView scrollable programmatically. In my project, all the buttons are in the same controller and no space to move.
Can anyone help?
My project image:

use UICollectionView and set UICollectionView.pagingEnabled = YES.
UIScrollView is the same but you need to do something for sub views and scrollView contentSize.

use HMSegmentedControl third party for same

Related

How to set constraints when all buttons are of different size

I have one view on view controller on that view I have six buttons I want to set constraints to these buttons but I am not able to do that. When I set constraints two of them get compressed don't know why.
I am sharing screen Shot,Please help me Thank you
You don't need six buttons for designing above screen. You can do this by using UITableView and custom UITableViewCell.
For more : Customize tableview cell
Or by using three UIViews by sub viewing UIImage and UILable and then add UITapGestureRecogniser to that UIView.
For more : Tap gesture

UIScrollView not passing touches to subviews?

I have a scrollview, I embed 3 controllers inside this scrollView in storyboard, and page between them horizontally.
content size of the scrollview is (scrollViewWith * numberOfControllers , scrollViewHeight)
scrollview appears and I am able to scroll horizontally thought the views, but the views don't detect any touch. (The controllers embedded have collectionViews inside them)
I implemented touchesBegin in one of the controllers, and it's never getting called.
Any idea what could cause the scrollview not to pass touches to subviews?
This isn't necessarily an answer to why touch events aren't making it to the collection views, but it sounds like you're reimplementing UIPageViewController with the transitionStyle set to .Scroll. Maybe consider using that instead?
when adding views to a controller through embedded segue, the view of the viewController is not added directly inside of the main view, but it's embedded in another container view before being added to the main view
ViewControllerView->EmbedView->EmbededViewControllerView
So I ended up removing them both, and manually add the view of the viewControllers to the scrollView
what kinds of view's you have inside every page of the UIScrollView?
You can add anything there, for example a UICollectionView, and the only way to prevent to not pass touches inside is having the UIScrollView set as:
self.scrollView.userInteractionEnabled = NO;

UITableViewController, Storyboards and UIKeyboard

I am trying to create a UI just like Facebook's comment screen on mobile.
I got a UITableViewController on my storyboard. I need to insert a view docked to the bottom of the screen to place a text field. Since the tableview is taking the full screen, I can't do it on storyboard and I think I need to do it programmatically but how? Should I modify the constraints that stretch the tableview to the edges and insert the views or what?
Thanks.
You can always add table view to normal UIViewController and below it add another view.

UIView overlaps UISegmentedControl

In my app, I want to add a UISegmentControl on top of a UIView.They are siblings of a parent UIView.I pull a UIView to the canvas from object library first, and then pull a UISegmentControl second,but unluckily the first added UIView overlaps the UISegmentControl. What I want is that UISegmentControl is on top of the UIView. I mean UISegmentControl z-index is higher than the UIView.
The following is the screenshot.
One potential solution would be to programmatically send either the UIView to the back or the UISegmentedControl to the front in viewWillAppear(animated:) using parentView.bringSubviewToFront(segmentedControl) or parentView.sendSubviewToBack(otherView). It doesn't solve the issue of the incorrect appearance in your storyboard but it ought to fix the issue once the app is running.
1) First reduce the width and height of the overlapping view to understand its location in view hierarchy. Share your view hierarchy here so we can see in detail.
2) Delete everything from storyboard. Add UIView and then add any subviews. These 2 controls should be children of UIView in view hierarchy.

iOS - Interface layout

I need to achieve the following interface layout:
The obvious path would be a table view, but how would I do the top player and the bottom button set doing that? Embedding buttons in a table view row is a little unsightly I'd say, any suggestions?
It looks like a composed hierarchy of UIViews to me. The topmost element is a custom UIView subclass whose subviews, in turn, are comprised of the appropriate controls. Next down, is a UIButton, then your UITableView (does it scroll? It looks like perhaps not.) Then another row of buttons (trash, etc.)
So, to summarize, your base view is just a UIView that you compose with subviews, including what I assume is a grouped UITableView in the middle. It will be easiest to layout in IB.
You can have multiple table views within a UIView. Or you can put the top and bottom controls in the table header and footer. A quick example:

Resources