Apollo
Apollo

Reputation: 9062

Static UIImageView at top of UITableView

Is it possible to add a static UIImageView that will "stick" to the UINavigationBar when scrolling through a UITableView?

In the image below, the gray image would essentially stick to the UINavigationBar so that it would be visible in that exact same position anywhere on the screen.

enter image description here

Upvotes: 0

Views: 228

Answers (1)

Wain
Wain

Reputation: 119031

You can implement the delegate method tableView:viewForHeaderInSection: and supply an image view (or an image view inside another view if you need some padding round the edges). This is assuming that you only have one section.

If you have multiple sections you would either need to add the image view as a subview of the table views superview or use contentInset and tamper with the scrolling.

Upvotes: 2

Related Questions