Hi guys i am having trouble to find out a solution from this problem so i am posting it.
So basically in ipod application we can configure the tabbar items from the application and drag them to change and customize it for ourself.
Does anybody know how to do it?
see the attached image please, thanks.
You really don't have to do anything more. That feature is automatically available when you add 6 or more tabs to the tab bar controller.
UITabBarController has a customizableViewControllers property which is an array of all customizable view controllers. This is set to the viewControllers property so all view controllers can be customized by default. If you intend to limit it then set this property appropriately.
Related
I have a requirement where i need to add a slide menu inside a tabbed content is it possible to add a slide menu inside a UITabBarController and parent of this UITabBarController is a UINavigationController ?
Without knowing more about your project it will be hard to provide a more in-depth explanation, but this should work:
Basically, I would recommend finding any one of the many open source "Swipe to Reveal" menus that are out there on places like Github. With a quick google search I found an example that might be useful to you.
Really all you should need to do is set the whatever "Swipe to Reveal" class you use as the root to the selected tab that you are in (If the initial viewController of the selected tab is a NavigationController then you probably want your slide menu to be the rootViewController of the NavigationController), and then you should be able to configure the menu to work within the selected tab just fine.
Please let me know if you need any additional help, and I can update my answer. Hope that helps!
Yes, you can do that.
I have done a similar thing for UINavigationController. And it is working for me.
I have created it as a re-usable component and added to GitHub, you can find it here: https://github.com/Midhun-MP/MMP_DrawerController
You can find a lot of controls here, better than my control ;)
I have the following setup in my app:
My initial view controller is a UITabBarController.
the tabs:
1)UINavigationController->PostListVC
2)UINavigationController->CategoriesListVC
3)UINavigationController->PostListVC
4)UINavigationController->PostListVC
5)UINavigationController->MoreViewController
As you can see, 3 tabs contain the same viewController class, but should not contain the same view controller object - the view will display different information based on information he gets form the AppDelegate.
What I did is I created 5 UINavigationControllers, connected them to the uitabbarcontroller, then created a rootViewController segue for 3 of them to the same PostListVC View - that way I don't need to maintain 3 designs of the same view.
The problem that I get is that only the first PostListVC gets created properly ( the leftmost in the tab bar ) - the other tabs that point to a PostListVC just show a black screen.
I've tried to illustrate the way I wire-up the storyboard using a 3-tab example:
As you can see, both the upper-most and lower-most views are connected to PostListVC.
I do not know what the issue is. I assume I'm using storyboards somewhat wrongly.
Does anybody know how I can fix this?
Thanks!
EDIT:
I have created a simple, example project (Xcode 5) that illustartes this issue:
http://www.speedyshare.com/Srwfg/TabBarProblem.zip
EDIT 2:
A modified version of the example, showing the problem with the offered solution:
http://speedy.sh/JkdGC/TabBarProblem-2.zip
There is no way to create different tabBarItems with this method, and there's no way to place the barItems so that they're not in a row - even if you try to chagne the order of segues.
As you said you need three different instances of PostListVC then you should create three different viewcontrollers of type PostListVC and connect each tab to its own. The class is the same but each tab gets its own instance.
I have got your example program to work BUT I don't know if the solution will work for your full project. Hopefully, it will put you on the correct track.
The solution is to have ONE (1) Navigation Controller / embedded root view but TWO (2) segues from the Tab Bar Controller. Here's the picture:
It looks like there's a problem with multiple UINavigationControllers linking to the same UIViewController. But no problem with the same UINavigationController linking to the same UIViewController provided they are instantiated separately through the UITabBarController.
Situation: two UITabBarController's, each with their own tabs, but last tab in both is identical so want one UIViewController to show content.
Issue at runtime: Shared item only appears in one of the tab sets when shown.
Question: anyone know a way to make this work?
Link to external graphic of storyboard setup: (sorry, don't have enough reputation to post images here!)
Storyboard graphic
An Xcode project with that storyboard:
XCode Project
Each tab content item has it's own UIViewController class. They contain no code except the line to make the back buttons work.
(Yes, I know this is odd. Real situation is an iPad app where tab controllers are shown in popovers; popovers are "property editors" where different objects have different properties, but all share a common set of properties... thus one tab for "unique" props, one shared tab content for the "common" props all objects have.)
I've found a couple ways around this to get the effect I want, but if this storyboard worked it would be a much easier solution.
-- Other info, somewhat unrelated to question --
Alternate solution I'm using: TabBarControllers only link to one VC as tab content. When that tab VC loads, I use code to (a) instantiate shared VC from storyboard by identifier, (b) add that new VC object to the TabBarController via [tabController setViewControllers:list animated:NO].
(Another possible solution I like even less: not using a TabBarController, and presenting content VC's with my own "tab" graphic drawn into them, each showing "myself" as selected. Yuk.)
So I have a working solution, I'm just curious as to why this doesn't work (just a known thing in iOS API, or some magical property setting that might render it functional?)
You can't put the same view controller instance into two tab controllers. The problem is that a view (UIView) instance can only have one parent view (superview). When you try to add the view controller to the 2nd tab, the view controller's view gets removed from its first parent (the first tab) and then added to the 2nd tab.
I stumbled upon your thread while running into the same issue today...
The solution is to just make a duplicate of the view controller in story board and attach the duplicate to the other tab bar controller.
I just did it and it works...
I think the 'rdelmar' is right about this... copy it and set it ..!!
I ran across this same issue today. I managed to come up with a workaround that seems to do the trick. The key is to add a layer of separation between the tabbar and the controller you want to reuse. From each tabbar, I created a relationship to a distinct UIViewController with a container view. Then you can do an 'embed' segue from the container to the controller you actually want to reuse as the tab view. It is not quite as clean as a direct connection (not sure why that is not supported) since you do have to create a controller class for each reuse case. It is still a better solution than the nightmare of having to duplicate the actual tab view ( as well as any additional views that connect to it) for every use.
Hope this helps. Let me know if anyone needs more details.
I am using the Storyboard in XCode to design my Views. Also im using the Tab Bar Controller in the editor, but i cannot seem to figure out how i can add a custom item which i can use for UIPopoverController.
Is it possible or do i have to create this controller programmatically and add it?
The apple documentation states that you shouldn't subclass UITabBarController, however, you could use a custom implementation like one of the ones found here:
http://cocoacontrols.com/platforms/ios/controls/altabbarcontroller
http://cocoacontrols.com/platforms/ios/controls/center-button-in-tab-bar
EDIT: This website appear to have exactly what you want - http://idevrecipes.com/2010/12/16/raised-center-tab-bar-button/
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.