How to display the UIActionSheet view from above Tab Bar Controller? - iphone

I need to display the action sheet above the Tab Bar controller. I mean, I would be able to see the Tab Bar controller even the action sheet view is in visible mode.
So, Please suggest how to view from above the Tab Bar controller. Is it possible.
secondly, How to change the back ground color of action sheet and cancel button back ground colour.
Please help me
Thank You,
Madan Mohan.

To display an action sheet from a tab bar, you can call the following within the view controller that is presenting it:
[actionSheet showFromTabBar:self.tabBarController.tabBar];
Note that the references explicitly state that action sheets cannot be styled. Nor is there anyway that I know of to make an action sheet appear on top of a tab bar. If you wish to step around the established interface guidelines in the manner you stated, you will probably have to create a custom view.
edit: The reason that the action sheet normally obscures the tab bar is that it is intended to be modal: either the user chooses an action, or they cancel. Either way, they shouldn't navigate away before making the choice, which your desired layout would imply.

Related

Programmatically hiding a view controller from a tab bar application

I am working on a tab bar application. Is there a way I can programmatically hide one view controller from the scroll down list and from the "edit" list (but still be able to pop it on screen with a certain action, i.e. by calling its tabbarcontroller index)?
The problem is that I have now so many viewcontrollers that completely fill the "edit" screen. So I want to hide some of them and be able to trigger the hidden ones trough some action performed on one of the visible ones.
Thanks

Tab bar at top and bottom

I would like to develop a ipad apps which has a menu at the top of the screen as well as at the bottom.
There are four buttons on the top of the screen, and there are 10+ buttons at the bottom tab bar, which can be scrolled horizontally.
How can I write the root view controller as a framework for this operation?
Should I customize the UIViewController class or UITabBarViewController?
Thanks
EDIT:
Sorry for being unclear. Let me restate my question.
Actually my app will have the following hierarchy.
'Front Page' is simply a page (view controller) for user to choose language. After choosing the language, 'Menu Page' view controller is displayed.
Starting from Menu page and ALL view controllers (VC) in below, the page layout is something like this.
As you can see, there are top menu and bottom menu. Clicking on the buttons the app will quickly jump to the corresponding view controller (3rd level in the tree, VC1,VC2,VC3 etc) . And for every view, there is a BACK button on every page, clicking which will back to the parent view controller.
I was thinking to implement this by using a tab bar view controller and a navigation view controller but I still do not have a clear idea how to implement this.
Or maybe should I just use the navigation view controller and hide the top tool bar except the back button, and display an overlay UIView as menu which is on top of all other UIViews.
Can somebody help me? Thanks.
Since this is the outermost container for my app I hope to do it properly at start..
Sorry for my long question.
If you really want to develop a framework for this logic .You need to create Manager, ViewController, View, DAO ,Model and other classes according to your needs.
I assume you want to add the buttons dynamically to the tabbar (and if it scrollable , it must be a scrollview).You can use Toolbar for upper view but then it won't be in sync with the bottom-view(visually).In that case you will have to create your own customized views to look like a tabbar.
The manager will basically keep a track of all the buttons and different states of events and action on the views and the same information can be accessed via a static method form the viewcontroller.
Well you have not detailed on your needs , so it's difficult to predict the entire architecture.
You need a container view controller to manage selection of VC's 1-4.
clicking which will back to the parent view controller
Parent view controller is used to mean the container vc in a container view controller scheme - I'm not sure that's what you mean in this comment. Where exactly does the back button go?
See this link for more info about container VC's.
https://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/CreatingCustomContainerViewControllers/CreatingCustomContainerViewControllers.html
You should be able to embed a tab bar controller in the content view of the container VC. Should be able to but it might be really buggy if there is a lot of communication between the child vc's.
The hard part is the back button. Basically it must be a button that goes back to VC 1-4 depending on which section you are in. The easiest way to do it is to make sure that when you cycle view controllers, pass the back button information as to which VC is the current child so it knows which VC to navigate to when you press it.

Control exiting of view while tab bar item change and navigation button press actions

I want to prevent one of my views from exiting when the user presses the top left navigation bar button as well as he changes the tab bar selection.My purpose is to show an alert and ask the user to save the data before exiting the view and act according to the user's choice.
I found an answer for preventing exiting of view in the case of left navigation bar button press action here :
Controlling changes in the navigation stack.
But Is there any common way to do that which can be applied to both tab bar item change and top left navigation bar press actions? Also if not how to do both in the easiest way? Hope my explanation is clear.
There's no single place you can take care of both. For the tab bar, set your UITabBarController's delegate to some class of yours (maybe your application delegate), and in that class implement the tabBarController:shouldSelectViewController: method to return NO when you don't want the user to change tabs.

Remove UISearchBar on tableView click

I have a UISearchBar which is subviewed by another view when a button is pressed. When it loads, it looks like the following (minus the red scribbles):
I would like to have the UISearchBar view be removed from the parent view controller when the tableView (the area with red scribbles) is clicked and is empty (no search has been made yet). I'm having a difficult time figuring out the best way to do this.
I have tried to put a transparent button in that section and add it as a subview to the search bar. However the button is underneath the tabl view area, so when the table view is clicked, the search bar loses focus and the uibutton is only then accessible.
Does anyone know how I can remove the search bar from the parent view controller when the empty table view below it is clicked?
Thanks.
To bring the transparent button up and make it catch all touched first, use [button.parentView bringSubViewToFront:button].
Another approach could be to catch the search bar losing focus (since you say you see that happening), by putting
– (void)searchBarTextDidEndEditing:(UISearchBar*)searchBar
in the search bar delegate, and handling it from there.

How to fit more operations to tab bar + navigation bar?

I want to use Tabview for my whole app. However in certain view, I have more operations than I can fit in the navigator bar. So I thought of using Toolbar but toolbar should be located at the bottom, right? Toolbar looks weird to be on top of the tabview, and hiding tabview for one view doesn't really make sense. I guess I can go with more buttons in the main view, but any other alternatives?
What can one use to add more operation(s) to tabview?
Thanks
In regards to keeping the UI simple, Apple recommends using a "More" button on the tab bar to fit additional functionality in on a tableview or some other NIB.
Additionally, you could always have another NIB that is hidden unless they hit a certain area or button and then it pops into view for controls, options, etc.