ios - uitableview 的提示信息(无数据提示)如何确保居中
PHP中文网
PHP中文网 2017-04-17 13:36:44
0
2
698

如上图[日历]app[无事件]的提示,我在我的 app 中设置 label.center = tableview.center 水平是居中了,垂直压着 cell 的线了,不能笨到根据不同分辨率(设备)计算 cell 偏移量然后设置 frame.origin.y 的距离吧?

如下图,因为相对 view 垂直居中不一定不压线

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(2)
Peter_Zhu

Specify the proportion for autolayout.
For autoresizingMask, don't fix top and bottom, fix the height, and then change it with the supview ratio.
In fact, you don't need to think about pressing the line, because the tableview is scrolling, and you cannot be sure that the line will not be pressed at any time. You can roughly estimate the height based on the height of the cell, but then you have to set y manually.

左手右手慢动作

I think the best way is not to display those horizontal lines in rows without data. This way the line won't be pressed.
A simple way is to add:

self.tableView.tableFooterView = [[UIView alloc] init];
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!