UITableViewCells visible behind title when scrolling up in swift - swift

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

Related

Add space between navigationBar and searchBar - Swift

I use some classical UInavigationBar and UISearchController at head of a UICollectionView.
My searchController is sticked to my navigationBar as I can scroll into my collectionView and use my searchController at any moment.
I'd like to know if there is a way to add space between my UInavigationBar and UISearchController as described in screenshot below :
You can adjust this in your storyboard if you have one, just select your searchbar and define constraints with the constraint icon (it looks like a square with two bars on each sides). Tell me if you still have the problem.

UITabBar isTranslucent adds an additional UITabBar?

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.

UISearchBar linked with a UISearchDisplayController in the header of a UITableView in iOS7

I have a UISearchBar linked with a UISearchDisplayController in the header of a UITableView in iOS7.
I set the UISearchBar with the style minimal. When the searchdisplaycontroller shows his table it has the behavior of the picture below. The table is scrolling above the searchbar. When I switch the style of the tableview to Prominent the table scrolls under the searchbar as expected.
Is this a bug or this behavior is expected?
The text isn't floating above the search bar, it's going below. Minimal style doesn't provide a background so this is expected. It will, however, provide a background during activation if there is a navigation bar present (Minimal style really wants to be over either no content or blurred content).
You are free to add your own custom background if you'd like.
Try with
self.edgesForExtendedLayout = UIRectEdgeNone;
in viewDidLoad method. It works for me.
I think this issue may for the Auto-Layout or Auto-Resizing. Just check in the nib file in insppector view.
Make the x=0 and y=0 for search bar and for tableview x=0 and y=44 , now you will get the tableview below the searchbar.

Change the color of moreNavigationController's icons

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.

What is the default fontsize, fontname and shadow for titles in Navigation Bar?

I'm trying to have a button on the self.navigationItem.rightButton that toggles a segmented control that is placed in self.navgivationItem.titleView .. this will however remove the title that is first set by self.title when the navbar is created .. I dont know if my approach is bad but I figured I could rotate between a UILabel and the Segmented Control in the titleView.
It works as I would like it to, however I cant figure out what size and font and shadowoffset and shadowcolor the default titles in a navigation bar is .. could you help me with a solution that either not force me to override the navigationItem.titleView or help me figure out the information needed to make a UILabel look exactly like the default titles.
Thankful for any help.
In code, something along the lines of:
http://www.iphonedevsdk.com/forum/iphone-sdk-development/11648-change-uisegmentedcontrol-font-size.html
should help, except you'll be querying the size, name etc. of the UILabel.