索引 0 大小的 UITableView 单元格
自定义表格中第一个单元格以像 Netflix 应用程序一样显示(即更大/不同)的最佳方法是什么?为了以后使用方便,已经要求我尽量使用IB,方便以后的编辑。
这是 Netflix 桌子的照片。 http://cl.ly/3j1d473d1j160502160t
What is the best way to customize the first cell in a table to display like the Netflix application (i.e. bigger/different)? For ease of future use, I have been asked to use IB as much as possible to make it easier for future editing.
Here is a photo of the Netflix table. http://cl.ly/3j1d473d1j160502160t
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
使用表头视图。将视图拖到表视图的顶部,它将成为“表头视图”。
如果您有其他这样的基本上恒定的“单元格”(并且可能会打开/关闭),您可以考虑将 UITableViewCell 对象放入 xib 中,并从 tableView:cellForRowAtIndexPath 返回它们:委托方法。还要实现
tableView:heightForRowAtIndexPath:
方法。两者可以具有相同的总体轮廓,例如:
Use the table header view. Drag a view to the top of the table view and it will become the "table header view".
If you have other such "cells" which are essentially constant (and might be switched on/off) you can consider putting
UITableViewCell
objects in your xib, and returning them from thetableView:cellForRowAtIndexPath:
delegate method. Also implement thetableView:heightForRowAtIndexPath:
method.Both can have the same general outline, like:
要么使其不是单元格(如表格的标题视图),要么实现
-[UITableViewDelegate tableView:heightForRowAtIndexPath:]
返回不同的高度。您可以使用 IB 来安装表头,但解决此问题的更复杂方法将需要使用代码。Either make it something that isn't a cell (like the table's header view), or implement
-[UITableViewDelegate tableView:heightForRowAtIndexPath:]
to return a different height. You can use IB to install a table header, but more complex ways of attacking this problem will require working in code.这是您可以使用的片段。它是表的标题视图...
-(UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
}
在这里您可以设置 tableViewHeaderSection 的高度。
(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)部分{
返回100;
(CGFloat )
Here is a snippet that you can use.It is table's header view...
-(UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
}
Here You can set the height for the tableViewHeaderSection.
(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
return 100;
}