customize uitabbarcontroller appearance - ios

Is it possible to change the way UITabBarController's look?
For example to arrange the tabBarItems vertically (instead of horizontally) and in the center of the view (instead of locked to the bottom)

For the changes you want, no.
What you are describing is an entirely custom interface that you will need to design from scratch.

It's impossible using the UITabBarController component. But you can use a UIView with lot of buttons that perform the same function of the UITabBarController buttons and place them as you want.

No as the other say, you can't. You can customize visually only the UITabBar using appearance API, but you can't change its layout.
What you want to do can be easily achieved by using the UIViewController container API (Read Managing Child View Controllers in a Custom Container) and simple view. Or using storyboards with custom segue.

Related

How should I structure a UINavigationController with an atypical header?

I have an app which uses a large custom header (see pic). There are two ways I can think of structuring this:
Subclass UINavigationController and add the header there. Unfortunately, I can't edit topLayoutGuide or layOutSubviews, so child layout is a problem.
Just hide the navigationBar and put the custom header view in each child.
Is there any way to manage child layout in the case of #1? I also use UIViewControllerAnimatedTransitioning to animate the views. Would that make one solution preferable?

How to mimic Android Bar on iOS?

my designer created this layout:
How can I mimic that on iOS? I tried creating a Segmented Control but didn't work well because it can't be customized after iOS7. So at the moment I'm thinking about a UIPageControl with custom dots like explained here: Customize dot with image of UIPageControl at index 0 of UIPageControl
My problem is also with the concept. Segmented controls are said to be used to flatten/filter results according to iOS human guidelines while UIPageControl has actually different pages...
Is this the best approach? If so, can I make it look like the Android Tab bar?
Segmented control with custom image
UIPageControl with custom image
UITabBar on top (read too many bad things about this approach)
something else
If UIPageControl is indeed the best/correct/possible approach how can I make it look as close as the image? And also move it to the top?
Thanks!
Short answer: Don't do that. You're trying to implement Android controls on iOS. That leads to user confusion and an app that doesn't feel like a native app.
Instead, have your designer create a native app design for both platforms.
It looks to me like the closest analog to what you're trying to do is a tab bar and a tab bar controller (UITabBarController).
EDIT:
If you must implement this UI on iOS, you might have to roll your own. You'd create a new custom parent view controller with a child view controller that you could swap out, and a custom control that triggers the swapping. Conceptually it would be a lot like a tab bar controller.
You could probably set it up using a container view and an embed segue (The embedded view controller would be the starting child view controller) and then use the built-in support for managing child view controllers to swap out the child view controller when the user taps on your control. I've done this sort of thing before. It isn't that hard, and is pretty well documented.

Navigation through the SegmentedControll (AutoLayout)

Good day!
How to arrange elements in ViewController so that when you switch SegmentedControll changed the contents of the second bottom half?
How to implement this with autolayout?
Thank you!
Ps. Very similar interface with Instagram (the first and second tabs). The Android turned out using TabHost, and there really tight... Or maybe this differently implemented and easier?
If you want to use a UISegmentedControl, you will have to manually manage switching the view controllers yourself.
You should take a look at these github projects, they provide view controller management coupled with a UISegmentedControl:
SNFSegmentedViewController
SDCSegmentedViewController
The other option is to use a UITabBarController instead. If you want a different look than what is provided by the UISegmentedControl, using the UITabBarController is the better option.

Visually modifying a UIToolbar from xcode storyboard

I'm using XCode 4 and storyboarding an application I'm creating, however I cannot visually modify the UIToolbar.
I'm attempting to modify a UIToolbar that is inside of a UITableViewController - however I have to place the UIToolbar out of the correct hierarchy in order to be able to modify it visually. I've tried placing it onto the view controller area but that does not make it show up.
At one point I was able to make it appear below, as it's own object however I was not able to recreate that.
Once I was able to get it to look like this
Your UITableViewController is inside a UINavigationController, which already has its own UIToolbar—you don't need to drag a new one into your view hierarchy. Interface Builder can simulate the toolbar for you under "Simulated Metrics" in the inspector panel.
Once the simulated toolbar is visible, simply drag UIBarButtonItems into it. Use a custom item with a custom view if you need anything more complicated than a button or spacer.
If you need your toolbar items need to be dynamic, you can maintain a reference via IBOutlets without necessarily having them in your view. Then set your UITableViewController's toolbarItems property or call -setToolbarItems:animated: at runtime to display the appropriate items.
See Apple's UINavigationController Class Reference: Displaying a Toolbar.
To answer your question, the visual editor simplifies the setup of most controls, view hierarchies, and delegation patterns, but it's still up to the developer to make sure they check out. The implementation of UITableViewController makes certain assumptions and assertions about its view hierarchy that Xcode does not enforce through the visual editor. Given that your desired view hierarchy is unsupported, I have to assume that the editor's behavior is either undefined or irrelevant. For a workaround, see Maxner's suggestion.
UITableViewControllers only allow one view object, which of course is UITableView. UITableViews are not cooperative for subviewing and they usually push everything into footers or headers. Something like this isn't possible:
-TableController
-Table
-Subview
-Another subview
UITableViewControllers are reduced to this:
-TableViewController
-Table
So you will need to use a UIViewController and declare a UITableView in there. Heres the Hierarchy you should use then:
- ViewController <Table's Delegate & Data Source>
- View
-Table
- Your UIToolbar
In your ViewController.h declare IBOutlet UITableView and connect Data Source and Delegate to the ViewController. Then simply add the UITableView implementations to your .m file and you're good to go.

Place UIToolBar above UISplitViewController?

I'd like to place a UIToolBar above a UISplitViewController but Interface Builder will not let me do so (using the standard split view template as a start). I know I can implement different tool bars in each of the two views within the UISplitViewController, but I want one seamless bar that lies outside the frame/bounds of the controller, directly above it and right under the status bar. Please help.
Thanks.
This is not supported by the UISplitViewController. If you need this sort of UI you would typically create a custom setup to achieve this.
I'd construct a setup using two UINavigationControllers that are controlled using my App Delegate and just take it from there. There will be some extra work for you, handling rotation, but that's to be expected when doing custom stuff.
This shouldn't be too hard.

Resources