I’ve a UITableViewController and when the consumer faucets an “edit” button, I show a toolbar on the backside of the display screen. I create a shadow on high of the toolbar. It seems nice (till I modified the colour to make it extra apparent shat’s going improper). Once I scroll the desk up, as quickly as the underside of the desk comes out from behind the toolbar, the toolbar colours all change into clear or do one thing that appears clear.
Here’s a image of the display screen when the desk has information that flows below the toolbar:
Here’s a image of the display screen as I drag the desk up and the final merchandise is barely partly below the toolbar:
Lastly, after I drag the desk as fr up as I can and the final merchandise is totally above the toolbar, I get this:
It’s apparent that the toolbar background is altering opacity because the desk is scrolling. I must disable this. I’ve tried varied mixtures of checking and unchecking the “below backside bars” and “below opaque bars” within the storyboard. I’ve tried including an empty footer and never including an empty footer to the desk. Right here is the code that creates the toolbar. Word that I am utilizing a desk view controller inside a tab bar controller and hiding the tab bar when the consumer edits the desk:
public func setEditingWithTabController( _ enhancing: Bool, animated: Bool, tabController: UITabBarController ) {
if navigationController == nil || navigationController!.toolbar == nil {
return
}
navigationController!.setToolbarHidden( !enhancing, animated: true )
var objects = [UIBarButtonItem]()
let versatile = UIBarButtonItem( barButtonSystemItem: .flexibleSpace, goal: self, motion: nil )
deleteButton = UIBarButtonItem(title: Strings.Delete.localized, type: .plain, goal: self, motion: #selector(didPressDelete))
deleteAllButton = UIBarButtonItem(title: "Delete All", type: .plain, goal: self, motion: #selector(didPressDeleteAll))
objects.append( deleteAllButton! )
objects.append( versatile )
objects.append( deleteButton! )
tabController.setToolbarItems( objects, animated: false ) // toolbar will get its objects kind the present view controller
let bar = navigationController!.toolbar!
bar.backgroundColor = AppSettings.appBackgroundColor.isDark ? AppSettings.appBackgroundColor.lighten( quantity: 0.05 ) : AppSettings.appBackgroundColor.darken( quantity: 0.05 )
bar.barTintColor = AppSettings.appBackgroundColor.isDark ? AppSettings.appBackgroundColor.lighten( quantity: 0.05 ) : AppSettings.appBackgroundColor.darken( quantity: 0.05 )
bar.layer.shadowColor = UIColor.purple.cgColor //AppSettings.appBackgroundColor.isDark ? UIColor.lightGray.cgColor : UIColor.lightGray.cgColor
bar.layer.shadowOpacity = AppSettings.appBackgroundColor.isDark ? 0 : 0.5
bar.layer.shadowOffset = CGSize.zero
bar.layer.shadowRadius = AppSettings.appBackgroundColor.isDark ? 0 : 20
bar.layer.borderColor = UIColor.clear.cgColor
bar.layer.borderWidth = 0
bar.clipsToBounds = false
bar.isTranslucent = false
bar.isOpaque = true
tableView.setEditing( enhancing, animated: true )
if enhancing {
refreshControl?.removeFromSuperview()
tableView.backgroundView = nil
} else {
refreshControl = UIRefreshControl()
refreshControl!.addTarget( self, motion: #selector( refreshData(_:) ), for: .valueChanged )
tableView.backgroundView = refreshControl
}
}
This similar factor occurred earlier than I added any of the shadow layer code however was a lot much less apparent with the background merely altering from white to mild grey after I scrolled the desk.
The operate above will get known as when the consumer faucets the “edit” button within the app header. Clearly I needn’t configure the toolbar each time this occurs and particularly when hiding it – I am going to fear about fixing all of that later. I want to determine why I can not get a clear unchanging toolbar. heck, I can not even appear to eliminate the grey line on the high of the toolbar though I am setting the border dimension to zero. This factor has a thoughts of its personal!
[CORRECTION]…
I used to be not setting a background colour. Now after I set a background colour, I get the translucency solely below the toolbar within the secure space inset like this: