I'm experiencing something very strange. If the property of my UITTabBar isTranslucent is set to false, it adds this weird double like (or a view? I don't know what it is really) above of the UITabBar.
tabBarController?.tabBar.isTranslucent = false
If this property is set to true, the problem disappears. And it makes no sense.
This is the effect I see if it's set to false
You haven't given a lot of context here, but I was faced with a similar problem and found a solution.
It's actually not the toolbar becoming higher, but the view above it not extending all of the way down to the tab bar. Now I don't know if you are using Storyboards or doing this programatically. In the child view of the UITabBarController you need to set Extend Edges -> Under Opaque Bars in the Storyboard or the property extendedLayoutIncludesOpaqueBars if you are doing it in code.
If you build this up with the storyboard, you can actually see the extra gap if you use an Opaque Tab Bar for your simulated metric on the Bottom Bar.
I faced the same problem when setting isTranslucent to false. My solution however was a bit of a workaround, which is to keep isTranslucent to true, but set the UITabBar backgroundColor to the colour I want it to be and it seems to negate the isTranslucent effect.
Related
This is probably a simple fix, but I haven't been able to figure out what's going on.
I have a UITableView that looks like this:
When I scroll up, however, the cells are visible behind the title, like so:
I've tried changing the navigation bar to opaque in appDelegate:
UINavigationBar.appearance().isOpaque = true
I have also tried editing the top insets on the UITableView without success. Any thoughts?
If anyone else has the same problem, I just had to set the UINavigationBar tint color like so, and make it non-translucent:
UINavigationBar.appearance().barTintColor = colorDict[currentClerkship]
UINavigationBar.appearance().isTranslucent = false
The question in title is probably pretty dumb, but i just can't find answer. I need to have invisible UITabBar (without TabBarController) which interacts with user exactly as visible do. If i set its HIDDEN property to YES it becomes disabled even if i leave UserInteractionEnabled checked. Also (since i'm already asking a question) i would like to know what OPAQUE property do. I switch it but nothing seems to be changed and Apple's documentation is not quite understandable for me personally
Another approach to have an invisible UITabBar could be to have invisible UIButtons (use the custom type), and use them for your behaviour.
you can set the alpha value of your tabbar to 0 it will be transparent.
I've managed to change the navBar tint, the background color and labels' color using this.
But is it possible to change the icons' color?
(those left to tableview's labels)
Thanks!
I don't know of a way to change the icon colors, but I don't really think all this hacking is necessary anyway - Apple certainly doesn't recommend it.
As far as I can tell, there is nothing special about the moreViewController, apart from being hard to customize. If it were me, I'd simply create my own custom viewcontroller, say MoreViewController, as a subclass of UITableViewController, add it to a NavigationController and then add that as the fifth and last item in the TabBarController. This table would then have a cell for each additional viewcontroller that I'd like to show. Then I'd be free to customize these cells to my heart's content.
This is an old question, nevertheless I'll post a fairly reasonable solution I found.
I first tried setting the global tint color to what I wanted, but that didn't work. Luckily, simply changing the tint color of the table view did work. Adapting code from here:
let color: UIColor
// ...
if let moreTableView = moreNavigationController.topViewController?.view as? UITableView {
moreTableView.tintColor = color
}
This still doesn't seem to affect the edit view controller, however.
EDIT:
There is actually a simpler way to do both, see this answer.
I want to apply a custom alpha value to the title of the UINavigationBar. The UINavigationBar is part of the UINavigationController and the UINavigationController is part of a UITabBarController.
Edit: Here is a picture of what I created using a UIToolbar and a UILabel. I want to do the same using the title in the UINavigationController: http://i.stack.imgur.com/B8YX0.png
I think the only way to accomplish this would be to subclass the UINavigationBar and override a method that allows me to set the Alpha when it's drawn.
Here are my questions:
Is this the correct way to do this?
What are the HIG ramifications of this?
I am new to subclassing in Objective-C, can you provide a guide or
tutorial that will help me grasp the steps required in subclassing a
UI Element and implementing a change?
When I get the subclass configured, I can view it in IB by changing
the class of the UINavigationBar to my custom class, correct?
Are there any "gotchas" that can come up with sublassing that an
expert like yourself can give me a head's up on?
This is something you shouldn't do. Why would you want to change that color but not the overall opacity of the bar? it decreases readability. There are multiple problems:
there is no public API, so it's not trivial
tampering with the subviews is fragile, may break and may have side-effects
it's not foreseen to be done -- the alpha value of the view is used and animated when pushing/popping a controller
If you really want to do it, there's only one clean, public way: Give each navigation item to be pushed a custom title view. You can tamper with that one as much as you want. So it's possible to set a view with a UILabel as subview and having it's alpha set to 0.5.
When a navigation bar is being managed by a navigation controller, there are only a few properties you're allowed to change (see docs). One of them is translucent which adjusts the alpha, but only to an Apple-determined value.
Running through an iPhone SDK book and one of the examples has me creating a table and then later adding a UISegmentedControl to the table for sorting.
I dutifully did this in IB, and it looks great:
IB Screenshot http://img.skitch.com/20100529-83sefni21q4nj51rw1mghh2yj1.jpg
When I run it in the simulator or my phone, it's totally squished:
Squished http://img.skitch.com/20100529-x3pmr7gkb6xpm766bupi7quy55.jpg
The buttons work perfectly, it's just they are not sizing according to their content. Any ideas what's going wrong?
Here's the attributes I have set:
Attributes http://img.skitch.com/20100529-tp4d69bk8x98c6sjpmcne92etb.jpg
You could try explicitly setting the width of each of the segmented control's components. Click the Size tab at the top of the inspector and set the width for each component.
I experienced the same issue once. The problem was that the UINavigationController's view was not the top-level view in the hierarchy (it was not added to UIWindow directly), but it was added as a subview to another view controller's view instead. It's just a guess, maybe that's your problem, too (or that there are more than one visible view controllers).
OK, so in attempting to implement #Chris Gummer's answer, I seem to have learned more about how the Size->View Size property panel works. The default is:
Default Sizing http://img.skitch.com/20100529-gg9dwq5em3557yb1d6d721hpn4.jpg
and this is not a good default, it would seem. My book didn't mention needing to adjust this, so I didn't look at it. Setting the inner horizontal arrow of the box (which I guess means "fit width to available space") did the trick:
The Answer http://img.skitch.com/20100529-xt1bqghb4kbm2pbcqf1i1uygab.jpg