adding Button on UITtabbar and My button must be higher than TabBar (Objective C) - ios

I'm working on UITabBarController. And now i want to add Button in the middle of UITabBar. The problem is my button must be higher than TabBar. In other words half of my button is out of TabBar. Is it possible? if it is possible, how can i do that? Thanks.

You can cover the UITabBarController with a UIView that has buttons. Use the buttons to programmatically select the correct tab. make the UIView have a clear background and be the height of the tallest button on the bar.

Related

Ios Swift : Adding or Moving NavigationBar to bottom of the view controller

I want to move the navigation controller bar to the bottom of the view controller. How can i get this done ?
I tried :
self.navigationController!.navigationBar.frame = CGRectMake(
0,
UIScreen.mainScreen().bounds.height - 50,
UIScreen.mainScreen().bounds.width,
50)
This is moving to the bottom but hiding all other controller objects and also back button is not woking.
Sujay U N,
You should not try to move the UINavigationBar provided by the embeded UINavigationController to the bottom of the screen. Trying that will obvisoulsy move all the view's below it causing all the controller objects to hide.
Workaround
Approach 1:
Consider using ToolBar :)
Toolbar is designed to be placed at the bottom of the screen. If you are using xib or storyboard you can pick toolbar from components library and place it on your ViewController's bottom and then apply autoresizing masks or constraints properly :)
Now in order to show the back button make use of UIBarButtonItems. Change the style to custom and provide it arrow image or provide default style as done.
Though now you are all set to go :) You will notice UINavigationBar at the top of your view controller. In order to get rid of it,
select your ViewController, select its TopBar property set it to none :)
Approach 2
Use UINavigationBar.
Specific about using Navigation bar and dont want to use toolbar, well you can do the same thing with UINavigationBar as well.
Drag the UINavigationBar from components library place it at the bottom of the screen. Drag the UIBarButtonItem drop it as leftBarButtonItem, change the barButtonItem image to your back image. ( Same process as UIToolBar just use UINavigationBar instead)
Understand this is not same as the navigation bar provided by the embeded NavigationController. So get rid of NavigationBar at the top of your ViewController same as I explained above here as well
Finally,
In both the cases, draw an IBoutlet from barbutton item and handle poping the viewController programmatically.
Happy coding :)

Bar Button Item is not Showing

I am trying to create a bottom toolbar. So I dragged I Bar Button Item to the View Controller and it was automatically position at the bottom, see image below:
But when I run the app, it doesn't show the bar at the bottom.
I already added:self.navigationController?.navigationBarHidden = false
I think it's just only a constraints problem.
First of all check your Document Outline near to the left of your table, to see the position (toolbar is just below table):
Add your constraints and pay attention to all options as shown in the picture:
Then, take a look to the size inspector, for the table view:
And for the toolbar:
This configuration working both in portrait/landscape mode.
Drag UIToolbar controller directly instead of only UIBarbutton item.
self.navigationController?.navigationBar.hidden=false
Have you set constraints of UIToolbar? I just guess it can be one of the reasons why you cannot see your barbuttoitem.
The navigation bar and the toolbar are two different things and the toolbar is hidden by default. Try setting the toolbar hidden attribute to false.
Sometimes bar button item and bar button do not show when we present our screen. On screen we can then not see bar button item and bar button. So we need to push our screen if we want bar button item and rightBarButtonItem.

Resize a TableView inside a TableViewController Swift

I have a TableViewController which comes from a TabBarController. Now my problem is that, the TableView becomes scrollable under my NavigationBar on the top which is transparent and I don't want this to happen.
The second thing is that the TableView's last cell goes below the TabBar which makes it impossible to select the last cell.
Can someone suggest me how to resize the TableView, so that I place it perfectly in between the navigationBar on the top and the TabBar on the bottom.
Thanks in Advance.
Select your UIViewController in storyboard and go to Attribute inspector. In Top Bar combo select Opaque Navigation Bar and in Bottom Bar combo selct Opaque Tab bar.

Recreate UITabBar to UIToolbar on select from Photos app

I need to do exactly what the photos app is doing when you press the select button. Basically just hides the UITabBar and presents a UIToolbar. For some reason this seems to be incredibly difficult if you don't want to implement a complete hack. I found a hack if you shrink the height of the UITabBar and change it's alpha to 0 but when you set it's height back to the default the image and text is condensed.
Turns out that I ended up just needing to call [self.tabBarController.tabBar setHidden:YES] to hide the tabBar and instead of using my existing UINavigationController's toolbar I create my own instance of a UIToolbar and add it as a subview of my view controller. Then using autolayout I pinned it to the leading, trailing, and bottom edge of the view. This handles rotation and other issues.

How to have a "Back button style" in the UINavigatorBar / Button

I have a UINavigatorBar and dropped a button to the left top corner in the Interface Builder.
Simple question:
The Button is round, how I can set the button to a "back-style" button?
(I mean, that the left side of the button is not round, it should be a arrow).
I just put together a simple UIViewController subclass that adds a customizable back button that allows you to change text colors. It basically adds some willAppear/willDisappear logic to animate the back button the way the UINavigationController does while using the leftBarButtonItem property. You'd just have to swap out the back-button PNG and change your colors in a subclass.
https://github.com/typeoneerror/BBCustomBackButtonViewController
If you want the back button to go back to the last view in the hierarchy, just leave the button off of the top left corner, and it should show up automatically.
Otherwise, you may need to subclass UIBarButtonItem.
I think if you want to do this with a UINavigationBar that does not work in conjunction with a UINavigationController you need to create a custom view for the button that is shaped like the back button.

Resources