Is it possible create such element on base UITabBarController?
If not, how do you advise create it. Thank you,
Is it possible create such element on base UITabBarController?
No, you cannot add your own controls to a tab bar. The tabs in a tab bar should be used as they're intended, i.e. to switch between several different view controllers.
If not, how do you advise create it.
I recommend that you don't try to create something that both switches between view controllers and also does other things. That said, if you want to add controls that work differently from tabs in a bar at the top or bottom of the window, UIToolbar is the right class to use. You might be able to create a subclass of UIBarButtonItem that has radio-button functionality similar to what UISegmentedControl offers, and you could then use that with UIToolbar.
I do not think you can easily add a UISegmentControl to a UITabBarController. If you check Apple Documentation UITabBarController accepts UITabBarItems which can be initialize with either an image/String or with one of the preset cases.
You could create your own TabBar and then add a UISegment Control onto that, but if I was you I would use the normal UITabBarController and make the two buttons one next to the other with images that makes it look like a segment control to the user.
The issue with this approach that the TabBar is not supposed to be there for you to have more than one item selected at a time. So you could not have notes and All selected at once.
It might be easier for you to add the UISegmentControl onto a UINavigationController at the top of your app, and then use the TabBar normally.
That is what I would do in any case.
Related
I would like to know if someone have an idea about how Tapbots made Tweetbot3 TabBar?
In my app, there will be many TabItems, and I don't want the "More" Tab (by default), but I'm very interested to have a similar system to Tweetbot, with a "picker" which opens on long press gesture on a TabBarItem.
But, I'm hesitating on the method. It's better to apply a customized UITabBar class, or to totally "deconstruct" the UITabBarController (to use a UIViewController and a custom "tabbar")?
Having created many custom tab bars, I'd start by subclassing UITabBar and UITabBarController. I wouldn't expect any roadblocks with this approach.
You may want to move the default buttons around and then add some custom buttons. Send a message back to the tab bar controller and let it display the popup choices view.
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!
I make my first "serious" iOS app, and have some troubles with the whole UINavigation concept, but all in order. I look answers for my questions but don't find what I want, so here it is.
I want to make menu to a game, it would be look like so:
1) It's a RootViewController and it contain some buttons: new game, options, about.
2) I think it will be another view controller (It must appear when we touch new game button, and we see a menu when we choose game difficulty) the buttons is: easy, medium, hard
3) The game view controller (I think that this VC won't be the part of UINavigationController).
I have some concepts that I want to embody in this menu.
Here is it: I don't want to use UINavigationController Navigation bar, I won't use standard slide animation for UINavCon, I want to make my buttons "move to transparency" and come back with another menu from paragraph 2 mentioned above, it's not necessarily to change background or something else except menu items.
I want to use custom back button, and want to add it to the position I want and not to Navigation Bar.
I have some ideas about animation of menu items.
I don't know this:
It is better to use UINavigationController for my purposes or it's better to use normal ViewController?
If I make a UINavigationController can I see it's "child VCs (I mean not a root VC)" in my storyboard or it will be programmatically created thing and I must make it UI in code? If i must do this programmatically, could I make a segue from UINavigationController from storyboard, or I must do this from code too?
Could I make a UIButton, for example, and assign it functions from a normal UINavigationController back button from Navigation Bar?
Some questions might be dumb, but hope you won't judge me hard.
Okay, I'll do my best:
For custom animations, see
Yes, you make a custom segue class with the animation. try: joris.kluivers.nl/blog/2013/01/15/… and developer.apple.com/library/ios/#featuredarticles/… and cmumobileapps.com/2011/11/04/a-short-tutorial-on-custom-segues
Yes, i think a view controller is your best bet. But by the way, even if you use a navigation controller, you still use normal view controllers. A UINavigationController holds different UIViews, which go forward and backward on the navigation stack. Also, you will need to look up what you need to do to hide the navigation controller.
You can see the child view controllers in a storyboard if you create them their, but not if they are created programmatically, unless you just have the view in their.
[self.navigationController popViewControllerAnimated:YES] will "press the back button" programmatically, so just link the custom back button to a method that calls this.
If that doesn't cover all of your questions, just comment and I'll answer any more :)
I have a large navigation menu, like a website header(Top logo, Bottom some menu buttons.) and this navigation menu must shown in every view of my application (like a masterpage, header(this navigation) will be static but content will change). What is the best way to represent this menu in my application?
I thought UINavigationBar may be appropriate but I am not sure about it. Can I customize it that much?
totally depends on how much is 'that much'.
you can use UIToolBar for more customization that what UINavigationBar allows, but you'll have to do some extra work in getting that functionality to match that of a nav bar,
or use a customViewController that has this largeNavigationMenu, and use it as a baseClass for all viewControllers you are using in your app.
You basically need to use some kind of container controller. Either a UINavigationController, a UITabBarController or maybe something custom like a drawer menu controller. Depends on the app design.
I've set up a storyboard with a UITabBarController object and I'd like to add two tabs to that, but both tabs are going to be exactly the same except for the data they will display. Obviously, I could drag in two new view controllers and connect them up and just maintain the views separately, but I don't want to do this at all.
Does anyone know the most efficient way of doing this?
I've done this by using a regular UIViewController with a tab bar at the bottom, rather than using a UITabBarController. You just have to use the UITabBar delegate method, tabBar:didSelectItem:, to detect the tab clicks, and then do whatever you need to do to switch what data is displayed in the single view.