This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Programmatically pressing a UITabBar button in Xcode
I've four tabs in Main tabbar controller. On 1st Tab, there is "Dashboard" Page which is displayed when User registered with Device-ID.
For non-existing Users, It'll prompt a message for Registration. And By clicking on "OK" button, I want to jump on 4th Tab which is used for Set-Up module.
So, how can I set Tabbar index as done with older earlier versions and navigation in Tabbar ?
Please tell me any Solution.
Thanks in Advance.
Execute the following line of code to get the tabBar begin with the 4 th tab selected when it will be presented
[tabBarController setSelectedIndex:3];
You have to implement this code first If you are using Tabbar based Application in Storyboard.
UITabBarController *tabBar = (UITabBarController *)self.window.rootViewController;
Then,
[tabBar setSelectedIndex:3];
As you said : AppleDelegate
Related
I have seen many other questions very close to this one but couldn't find a solution for this precise case :
I have a tab-bar application, connected to 4 UIViewControllers. I'm trying to connect one of these 4 UIViewController to another UIViewController using a Show action segue and keeping my tab bar displayed.
I'm not embedding the 4 first UIViewControllers in UINavigationController.
Simulated metrics are set to inferred and "Hide bottom bar on push" is unchecked. Segue kind is set to "Show (e.g. Push)".
On my storyboard, the tab bar automatically appears at the bottom of the last created view when I add the segue. When building the project, the tab bar is visible only on the 4 UIViewControllers directly linked to the TabBarController. However, I lose it when the last view is showed.
How do I keep my tab bar displayed on this last view ?
Many thanks for your help !
Found this simple solution :
I have embedded the first ViewController in a Navigation Controller. As I didn't want to show a navigation bar in my header, I simply hid it in Viewdidload :
self.navigationController?.navigationBarHidden = true
Hope this will help someone !
This question already has answers here:
How to Identify tab bar items?
(3 answers)
Closed 7 years ago.
I am implementing a tab bar based application and i need 6 tabs in the tab bar,but the tab bar is displaying only 4 tabs and in Fifth tab it is displaying More with 5th tab and 6th tab in table view.
Can i have 6 tabs in tab bar without More tab?
Maximum is 5 Tabs in a tabbar. This is because when there was more than 5 tab, they would be too small and for people with thicker fingers it would be difficult to hit the wanted tab.
If you really want, you can write your own tabbar-controller that allows 6 or even more tabs, but you should not do that. The chance is high, apple will reject your app because it doesn't meet apples design-rules. And I think it is good, that apple rejects such apps!
You will have to create your custom tab bar controller for that.
You can not have 6 tabs in tab bar without More tab. After adding 4 tabs, in Fifth tab it will display More with 5th tab and 6th tab and it is the characteristics of tab bar in iOS. You can try toolbar.
Yes you can do this thing but you need to use customview.
your tabbar works in back-ground and place a custom view at bottom in window and set delegate for it and add this view in main window.
then you will hit button at bottom and you can redirect event to appDelegate class by delegate.
where you can set your desired tab as by button hit.
i think you may get some ideas.
I have created a Windows application.in my appdelegate I have called a controller class named analogcontroller and added this class to my window so that when I run my application the page that should come first is this page that contains an analog clock with five tabbaritems in it each calling different class.
So in the analog controller class xib I have added a tabbar with 5 tabbaritems in it. But when I run my application the page that gets opened is the page of the firsttabbaritem instead of analogcontroller. I want that when I run my application my xib of analog controller should be called with 5 tabbar items below it and when I click on particular tabbaritem then only its corresponding page should be opened, otherwise not. How is this possible?
you can set tabbar selected index to your desired tab index it starts from 0
you can write something like tabbarcontroller.tabbar.selectedindex =1;
Forgive syntax errors... you should try this. xCode is rich editor.
If you have a visible tabBarController, then something will necessarily be selected. No way around this.
However, if you would like to hide the tabBar, then you can certainly do that, either by setting its hidden property to YES or by presenting a modal view on top of the selected tab (e.g. the first viewController).
similar question here
I've created a tabbar application using the template in Xcode, and have setup a working tab bar application. I want to know how I can change the view currently on the screen using a UIButton, so the result is the same as if the user just clicked one of the tabs.
this is question was also asked by me and got good answer
look at
Click a tab of tabbarController programmatically
hope it will help....
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
View Controllers: How to switch between views programmatically?
i want to go to another view from one view on a button click
please help me........
thank you
Use a UINavigationController to display the first view. When the user taps your button, call the navigation controller's pushViewController:animated: method. To return to the previous view programmatically, call one of the pop...ViewController... methods (though this may not be required, since the navigation controller itself can handle "back" button taps).
If you don't want to use the uiNevigationController then use:
[self.view addSubView:objectOfSecondPage.view];
and add this on the back button in the next page
[removeFrom SuperView];