I created an UITabbarController that its first item is an UIViewController, this UIViewController contains a button that must open UITableViewController.
I created the UITableViewController and UIViewController in the StoryBoard and gave them identifier name.
my problem is,when I press the button that is in the UIViewController to open the table, it opens the UITableViewController but without the tabBar and I want the UITableViewController be as an item from the tabBar (item opens other item)
how to do this ?? can anyone show me sample code
sorry for my bad explanation.
consider that I'm using Xcode4.3
Embed ur view controller inside a navigation controller. make this navigation controller as the tabBar Controller's view controller(first item) .Don't present the table view controller modally . instead segue it using navigation controller.
Related
I've got an initial view controller InitialViewController with a button "List" (and a few other random buttons).
Clicking on "List" segues to a UITableViewController that is embedded in a navigation controller. And that is all sweet.
But once the UITableViewController is loaded there is no "back" button to navigate back to InitialViewController.
I was just wondering what my options were. On the storyboard I've used a "Navigation Item" and "Button Bar" and i'll hook that up programmatically to navigate back.
I just wasn't sure if an unwind segue was an option or if anyone had better ideas.
Thanks.
The reason you don't see a back button when your UITableViewController is loaded is because it is the root view controller for the navigation controller that it is embedded in. As such, the NavigationController has no other view controller in the stack that it can go back to.
Instead of the TableViewController, embed your InitialViewController inside a NavigationController and that should add a navigation bar with Back button to your TableViewController.
If you don't want to show the Navigation Bar in your InitialViewController, you can hide it using the following steps:
In your storyboard file, select the InitalViewController
Open the Attributes inspector and set Top Bar to None
Hope this helps!
The main view of my iPad app is a TabBarController. Each Tab contains a UISplitViewController.
The UISplitViewController contains UINavigationControllers.
How do I change the tab's BadgeValue from a ViewController located within a UISplitViewController.
I've tried setting the TabBarItem property of the ViewController but there is no effect.
Strangely the UIViewContoller's NavigationController and SplitViewController property's are null even though the UIViewContoller is in a NavigationController which is in a SplitViewController .
Summary: The Heirarchy looks like this:
tabbar
splitview
navigation
viewcontroller
Found it.
A TabBarController's tabbar is accessed by the direct child, in this case the SplitController.
Because the SplitController doesn't get loaded until the tab is pressed, you have to set the badge when you create the tabbarcontroller (a custom one).
theSplitController.TabBarItem.BadgeValue = items.Count().ToString();
I have a storyboard as seen in this picture:
From a table view cell, I modally present a new view controller which is a subclass of UITableViewController. In the scene on the RHS I have a UINavigationBar. But when my view is presented, it does not have it. Why is that? Thanks!
You'll need to embed your subclass of UITableViewController that you want presented modally inside of a UINavigationController.
To do this, click the view you want presented modally in your Storyboard, then go to Editor>Embed In>Navigation Controller.
I have a tableview with about 10 items.
I have set up a UIView Controller as a detail page.
I Control-Drag from my cell in the tableview to the new view controller, and I can create a Push Segue, however the navigation control does not appear on the new view controller.
When I run the application my prepareForSegue method executes but my application does nothing. The detail UIView Controller does not display.
What step am I missing to make this work?
The Push segue only makes sense for ViewControllers embedded inside a UINavigationController. You can do this easily by selecting your tableview's ViewController in the storyboard and choosing in the main menu:
Editor -> Embed In -> Navigation Controller
my app first viewController is UIViewController.
and when user click button firstView disappear and push UITabViewController
is it possible?
i can't find how to push UITabViewController from UIViewController.
UPDATE sorry, I misread TabVC for UITableViewController. Do you mean UITableViewController or UITabBarController? I'll leave my answer below anyways.
In this instance, it's usually best to have a UITabBarController be the root view object. Although it can be done, it's a messier implementation, in my opinion.
I would in fact make the UITabBarController the root and display the UIViewController modally from that UITabBarController on launch.
The user would be presented with the UIViewController and when they clicked the button, dismiss that modal view, revealing the UITabBarController.
Just use a UINavigationController.
Use the navigation controller to push the tableView as the second level in the hierarchy. As a bonus you'll get the back button for 'free' and you don't have to worry about delegates for getting back to the original UIViewController.
you may try this:
self.tabBarController.selectedViewController
= [self.tabBarController.viewControllers objectAtIndex:2];
it should work because selectedViewController property contains view of selected tab.
First of all you have view controller . And make Second view controller which contain tabbarcontroller . Now just push second view controller . And add tabbarcontroller's view as a subview to second view controller .
Hope you gets it ..