I am using UITableView header to add UIImageView and other labels.
But I am unable to place UIImageView in between navigation bar and UITableViewHeader. my Image is going behind navigation bar.
Pls refer the expected design screenshot. Thanks in advance. pls guide me on this.
You can manually add an UIImageView in navigationBar, something like (I am using SnapKit for demo so ignore it. You can also make frame | autolayout yourself):
let categoryImage = UIImageView(image: UIImage(named: "icon_category"))
navigationController?.navigationBar.addSubview(categoryImage)
categoryImage.snp.makeConstraints { make in
make.width.height.equalTo(50)
make.centerX.equalToSuperview()
make.bottom.equalToSuperview().offset(25)
}
Another way is just hide default navigationbar then add your custom view instead
2
Answers
You can manually add an UIImageView in
navigationBar
, something like (I am using SnapKit for demo so ignore it. You can also make frame | autolayout yourself):Another way is just hide default
navigationbar
then add your custom view insteadYou need to use custom navigation bar to place any object on it as we cannot customize the default navigation bar in such ways.