Set yourself as the toolbar delegate. Then in your view controller, implement UIBarPositioningDelegate
. Implement it as follows:
Objective-C
- (UIBarPosition)positionForBar:(id <UIBarPositioning>)bar {
return UIBarPositionTopAttached;
}
Swift
func positionForBar(bar: UIBarPositioning) -> UIBarPosition {
return .TopAttached
}
Also make sure you move your toolbar 20 points down (as you already did), or right underneath the status bar, for this effect to take place.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…