add or present view before launching first tab view controller - objective-c

I am making an iPhone app in which I have used both, the navigation as well as the tabbar controller. Now after splash screen I want to show a UIView before showing the first view controller of the tab bar.
Currently I have added one subview on first tabBar controller. But this view gets messed up with the first tabBar controller's view.
Can anyone tell me that is it possible to add or present a UIView before launching the tabBar controller? If anyone has an idea please do let me know.

Use the storyboard. Make your additional view the first scene. Add a segue to the tab view. If you want an automatic transition, trigger the segue by a timer.

Related

Modal view before UITabBarController

Im trying to present a modal view controller from subclass of UITabBarController. I present it from viewDidLayoutSubviews method. Everything works fine on iOS 7 but in iOS 8 when app stars i still breafly see TabBarControllers first tab.
TabBarController is set as initial view controller in storyboard.
Is this even a good way to present it or there is something for iOS 8 that i dont know?
I don't have the rep to post a comment, so I'll seek clarification and provide guidance through this answer.
Is the intention that the modally presented view controller will be the first thing people see when they launch the app? And then I suppose it gets dismissed, and behind it will be the tabbar controller? How is your storyboard currently set up for the modal view controller if the tabbar is set to be the initial view controller?
One place to start could be to move to code to viewWillLoad or viewDidLoad rather than viewDidLayoutSubviews. I could also suggest to just make the modal VC the initial view controller

Creating an View without the navigation Item bar in Xcode

I am trying to connect a new empty View(homeScreen) from a ViewController (loginScreen) using Xcode 6 Beta 4 and Swift. A button triggers the segue to the homeScreen View. The problem is that when I add the segue, my blank/empty homeScreen View magically gets a Navigation Item Bar on top of the view.
You can see that without the segue my homeScreen View its empty:
After the segue it looks like this:
As you can see, Xcode inserts the Navigation Item Bar on top (grey rectangle). I would like to know how to get rid of it or how to create an empty View that remains empty even after assigning a segue to it.
Thank you so much for your help!
Cheers!
UPDATE: My goal is to create a navigation bar kind of like the one Facebook implements in its' iOS app. On top have the search bar and maybe some more icons. Does anybody know how to do that? I tried to hide the Navigation bar by selecting my view controller and in the Attributes inspector setting the "Top Bar" attribute to none, but it does not work. Any suggestions?
Thanks again.
Does loginScreen is inside a UINavigationController? If it is, the new showed view controller (homeScreen) is supposed to be in the navigation controller too, and thus it has a navigation bar by default.
You can hide it if you want, but then you have to find an alternative way to navigate in your navigation controller.
Otherwise you can present the homeScreen modally changing the type of segue to "Present Modally".
For more details on view controller presentation see this document plus some updates in iOS8 (WWDC session: View Controller Advancement in iOS8).
EDIT: To implement the FB-like navigation bar I would customize the UINavigationController bar:
read this AppCoda tutorial about customizing the bar
to add a search bar use the code like:
let searchBar = UISearchBar()
...
self.navigationItem.titleView = self.searchBar
This is because the segue is a "push" segue ("Show (e.g. push)") from a View controller that is already included in a Navigation controller. Therefore, it is put in the stack of views of this Navigation Controller, and therefore receives a navigation bar.
If you don't want a navigation bar, then use either a modal segue ("Present modally"), or a custom segue.
Same thing if you need a different navigation Bar (not linked to the first Navigation Controller). You can perfectly have a modal segue leading to a UIViewController, which is embedded in its OWN navigation controller (or having only a navigation bar). Have a look in the menu: "Edit / Embed / Navigation controller".

Tab Bar controller disappearing when moving to another view (iOS SDK, Using storyboards)

I am building an iPhone app using storyboards and I have a problem with the tab bar controller. On one of the views that is linked from the tab bar controller (view1), there is a button that leads to another view (view2). On View2, there is a button that leads back to View1. Very straight forward. But when I go from view1 to view2, the tab bar disappears, and even worse, when I go back to View1, the tab bar is still gone...
How can I fix that? (I have yet to put ANY code in the app, there is only the storyboard and the apple provided AppDelegate Class (and also a main file I suppose, but I am not intending on touching that).
Any Reply is Highly appreciated!
If you do a modal segue from a view that is a tab bar view, it will get rid of the tab bar for the modal view you are presenting.
Secondly, when you segue you are creating a new instance of the view controller. So I am guessing you are segueing from view1 to view2 and losing the tab bar, then you are segueing back to view1. At this point you have created view1, view2, and a second copy of view1 that does not have a tab bar.
I would suggest one of two things.
1.) If you want to keep the tabs at the bottom when you segue from view1 to view2, then click on view1, at the top of the screen select Editor/Embed In/ Navigation Controller. This will embed your view1 in a navigation controller. Then if you change your segue from Modal to Push it will keep your tab bars at the bottom. The navigation bar at the top also make it easy to go back from view 2 to view 1 the correct way (by popping the view) rather than creating a new segue. If you do not like the navigation bar, then you can change the "Top Bar" property to "None" in the inspector. You will then need to create some other way in view2 to get back to view1. (BY POPPING THE CONTROLLER, NOT BY SEGUEING)
2) If you don't want to set up a navigation controller you will have a little bit harder time keeping the tab bar stuff at the bottom of the view2 controller. In fact, I'm not sure you can do it at all with a modal segue, you'd probably have to write some type of custom segue. Either way, If you want to transition back to view1 and get to the correct controller (not a new version without the tabs) then you need to attach an action to whatever button you are using to segue and use the following code (I also attached the code for navigation controller push segues, in case you create a navigation controller and get rid of the navigation bar.)
For Modal Segue:
[self dismissModalViewControllerAnimated:YES];
For Push segue:
[self.navigationController popViewControllerAnimated:YES];
Your best bet is to use the navigation controller method, as you are assured to keep your tabs. You can then either use the navigation bar to return (the easy way, no code needed) or you can get rid of it and use a button and the code above.
Good luck!
I had the same problem, i know this is an old question but [self dismissModalViewControllerAnimated:YES]; is deprecated in iOS 6.
What i used is:
[self dismissViewControllerAnimated:YES completion:nil];

iPhone Navigation Controller Back Button?

I want to add a Back button to a Navigation Controller. This is how my storyboard looks like:
I have a ProgViewController for the main screen. The TableView is embedded into the Navigation Controller. I also have a ProgPlayersViewController for the TableView.
My question is how can I add a Back button to the Navigation Controller?
Thanks for your help.
ProgViewController needs to be in the navigation stack so that you can go back (ie. 'pop') to that view controller.
The actual button itself is created by the navigation controller assuming that there is a view controller to actually go back to.
The navigation controller, as you have it in your diagram, needs to be before the ProgViewController and not after it.
Note if you don't want the navigation bar to be visible in the ProgViewController you can set it to hidden.

UINavgationController and UITabBarController together

I am trying to create a view with a TableView in the center, NavigationBar on top, and a TabBar with 5 items. The TabBarItems will be attached to 5 different modal views. And the tableview can select an item and "navigate" to another tableview or detail view.
Following the Apple doc, I tried to create a NavigationController in a TabBarController in IB, but failed. I read all the posting regarding to this topic, and they all described a NavigationController inside one of the TabBarItem. But that is not what I want. The TabBarController and NavigationController are separate controller doing separate thing in the same view.
So I start wondering maybe it is a design issue. I should just use a NavigationController and add the TabBar as objects and not controller in the view.
Am I going the right track or is there a better way to combine NavigationController and TabBarController in IB to do the job that I want. Am I making sense?
If the tab bar is actually being used as a tab bar, it sounds like you want 5 navigation controllers, one for each tab.
If the tab bar is being used as a toolbar to hold buttons that bring up modal view controllers, push views onto the navigation controller, or other actions besides what a tab bar is intended for, use a UIToolbar instead. UINavigationController actually has toolbar support built in, just set its toolbarHidden property to NO and set the toolbarItems property on each view controller that can go inside the navigation controller to an array of appropriate UIBarButtonItems.