简体   繁体   English

iOS:如何将图像放在iView之类的tableView顶部

[英]iOS: How do I put an image on top of the tableView like iBook

If you scroll all the way up on the iBook, you can see an apple mark (above search and two buttons). 如果在iBook上一直向上滚动,则可以看到一个苹果标记(在搜索和两个按钮上方)。 How can you put such image on top of the TableView? 如何将此类图像放在TableView的顶部?

My first guess is that apple just used an image as its background and somehow aligned it right. 我的第一个猜测是,苹果只是使用图像作为背景,并以某种方式使其对齐。 Am I on right track? 我在正确的轨道上吗?

It's a UIImageView , either set as a tableHeaderView (check the docs) with the table given negative-top contentInset , or just added as a subview of the table view itself. 它是一个UIImageView ,可以设置为tableHeaderView (检查文档),并在表中指定负负contentInset ,也可以将其添加为表视图本身的子视图。 The latter's probably simpler—just set the image view's position to something with a negative Y value. 后者可能更简单-只需将图像视图的位置设置为Y值为负的值即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM