UIViews & View Controllers And why is it always... - uiview

Why are all the examples dealing with UIViews and there ViewControllers always incorporating a navigation bar, a tab bar, a split view, or a table view?
What is stoping me from creating say three plain UIViews, and three view controllers and using gestures to navigate between the views? Is there an architecture in place that would prevent me from doing this?

Techincally nothing prevents you from doing this, and you can always make yout own navigation systems with custom gestures and animations etc. Using the standard way of coding (i. e. with navigation bars, view controllers, etc.) is recommended though if you don't want to make a special UI and just create a standard "iOS-looking" application.

Related

iOS - Search View Controller glitch

I can only assume the effect above is happening because Search Display Controllers are normally designed to work with just a navigation bar above them. As you can see, in this design there is a toolbar containing a segmented control underneath the navigation bar.
This is creating quite a mess as can be seen in screenshot two. Is there any way to just disable the Search Display Controller position animating effect or offset it differently in any way?
The end goal was simply to have 3 different lists in 3 different views and have each one filterable. Any ideas how to get around this view glitch?

Custom UITabBarController with Scrolling

I am developing an application that requires a scrolling UITabBarController. The customary 5 tab items max with the 5th being the More.. tab just won't do. I have found some pretty great third party classes such as https://github.com/Marxon13/M13InfiniteTabBar and they are great and have the functionality I would like but still, things aren't perfect. When I rotate my device to landscape things become glitchy.
Basically, I am fed up and want to create my own custom UITabBarController with scrolling..how would I go about doing this? I understand I would most likely put a UITabBar within UIScrollView but I am lost without a detailed tutorial of sorts..
Any help would be greatly appreciated! Thanks!!
The way I would approach this is to avoid modifying the UITabBar, since it is highly specialized, and create a UIViewController subclass that will provide this functionality for you. This view controller should have a container view (take a look at this Apple documentation for more detailed information) that will have each child view controller's content view.
For the actual tab bar itself, you have a few options depending on what you similar you want it to the standard UITabBar.
You could have a super basic tab bar that consists of a UIScrollView with standard UIButtons that change/load the correct content view controller. Creating the tab bar would be then easy, simply add the buttons to the scroll view inside some type of loop (you could have the x positions be a multiple of the tab index to make positioning easier). UIButtons have support for a selected button state that you can use. You can change the scroll view's background.
You could have a fancy tab bar which is constructed essentially like the above, but by having a custom UIButton subclass instead of a standard UIButton. This will allow you to implement a more intricate design (i.e. with and more customized touch handling.
Tips:
Use [myImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] to have your tab images tinted like the standard tabs when selected.
Design the basics of your custom view controller in your storyboard. It is really easy to add the child container view and the scroll view this way.
Hope this helps!

HMSegmentedControl (custom tab bar controller) switching subviews feature

I'm looking for a way to use HMSegmentedControl inside a UINavigationController, using the tabs to change the subview. That is clicking on a tab should display the corresponding view below the UINavigationBar and the HMSegmentedControl tabs. If possible, using as much as Storyboard features as possible.
I have made several attempts, by inserting the views as outlets. The further I got is to have it running by using when detecting a tab selection change (and removing the other subviews obviously):
insertSubview:(UIView *) belowSubview:(UIView *)
but it cuts the upper part of the subview (the one overlapping with the HMSegmentedControl tabs bar) and also makes the non-initial views not behaving well in terms of autosizing (for instance when rotating the screen).
Are there best practices for implementing such custom upper tab bar controllers inside a navigation controller (and not the opposite because of another dependency I am using)? Or better yet is there an easy way to do what I am trying to do using Storyboards?
I think it is better to juggle controllers than views.
I would have several controllers with identical navigation bars. That is an identical HMSegmentedControl in their bars.
As the user changes the selected segment you switch controllers and make sure to adjust both the exiting and entering controller's segment control state accordingly.
You could also try to have all navigationItems to point to the same HMSegmentedControl instance and see if it works.

How do I display the same navigation bar throughout many views?

I can reproduce the following navigation bar for one view:
However, once I move to the next view after clicking a button, I lose the top two rightmost icons(Search, Profile). I understand that setting up navigation item from a storyboard is usually per view. I can replicate those items for each view but I was wondering if there was a better way to do it once.
Is there a tutorial that explains how to maintain a custom navigation bar across many views?
You need to set it up for every view. You should probably create a superclass and implement it there, so you only need to actually write the code once.

iPad landscape single navigation bar

My app in iPad mode and landscape calls for a single navigation bar its proving troublesome.
The idea is that in landscape there wouldnt be 2 separate nav bars for Master and Detail : see below (Images taken from Google Images and modified, not my project)
but instead there would be a single nav bar, like so:
I'm trying to avoid very hackish methods because my navs use a lot of custom stylings but the only way I can think at the moment is to resize the view in the SplitView superclass and override the nav bar, but wanted to see if anyone else had any success before
Any ideas?
The way that the split view controller works, it displays two separate view controllers. If you want to have the unified navigation bar, don't use a split view controller, just use a regular view controller, and embed the table view in your normal view, and implement the appropriate protocols to control the table

Resources