标签: uitableview

如何调整UITableView的tableHeaderView?

我无法调整tableHeaderView的大小.它简单不起作用.

1)创建UITableView和UIView(100 x 320 px);

2)将UIView设置为UITableView的tableHeaderView;

3)建立和去.一切都好.

现在,我想调整tableHeaderView的大小,所以我在viewDidLoad中添加了这段代码:

self.tableView.autoresizesSubviews = YES;

self.tableView.tableHeaderView = myHeaderView;
self.tableView.tableFooterView = myFooterView;

CGRect newFrame = self.tableView.tableHeaderView.frame;
newFrame.size.height = newFrame.size.height + 100;
self.tableView.tableHeaderView.frame = newFrame;
Run Code Online (Sandbox Code Playgroud)

tableHeaderView的高度应显示为200,但显示为100.

如果我写:

self.tableView.autoresizesSubviews = YES;


CGRect newFrame = myHeaderView.frame;
newFrame.size.height = newFrame.size.height + 100;
myHeaderView.frame = newFrame;


self.tableView.tableHeaderView = myHeaderView;
self.tableView.tableFooterView = myFooterView;
Run Code Online (Sandbox Code Playgroud)

然后它按照我想要的200高度开始.但我希望能够在运行时修改它.

我也试过这个,没有成功:

self.tableView.autoresizesSubviews = YES;

self.tableView.tableHeaderView = myHeaderView;
self.tableView.tableFooterView = myFooterView;

CGRect newFrame = self.tableView.tableHeaderView.frame;
newFrame.size.height = newFrame.size.height + 100;
self.tableView.tableHeaderView.frame = newFrame;

[self.tableView.tableHeaderView setNeedsLayout];
[self.tableView.tableHeaderView setNeedsDisplay];
[self.tableView …
Run Code Online (Sandbox Code Playgroud)

iphone cocoa-touch uitableview

100
推荐指数
7
解决办法
9万
查看次数

如何调试'无法识别的选择器发送到实例'错误

我正在为表视图创建自定义表格单元格视图.在我将自定义单元格(在故事板中)的图像视图连接到swift中的代码后,我收到以下错误.

[UITableViewCellContentView image]: unrecognized selector sent to instance 0x7fb4fad7fd20'
*** First throw call stack:
(
    0   CoreFoundation                      0x000000010ccbb3f5 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x000000010e7e9bb7 objc_exception_throw + 45
    2   CoreFoundation                      0x000000010ccc250d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
    3   CoreFoundation                      0x000000010cc1a7fc ___forwarding___ + 988
    4   CoreFoundation                      0x000000010cc1a398 _CF_forwarding_prep_0 + 120
    5   UIKit                               0x000000010d7d8881 -[UITableViewCell _marginWidth] + 151
    6   UIKit                               0x000000010d7ca23d -[UITableViewCell _separatorFrame] + 70
    7   UIKit                               0x000000010d7ca6fa -[UITableViewCell _updateSeparatorContent] + 360
    8   UIKit                               0x000000010d7d4e85 -[UITableViewCell _setSectionLocation:animated:forceBackgroundSetup:] + 1174
    9   UIKit                               0x000000010d634ea8 __53-[UITableView _configureCellForDisplay:forIndexPath:]_block_invoke + …
Run Code Online (Sandbox Code Playgroud)

uitableview ios swift

98
推荐指数
4
解决办法
9万
查看次数

如何知道UITableView何时在iPhone中滚动到底部

我想知道什么时候UITableView滚动到底部以加载和显示更多内容,像委托或其他东西让控制器知道何时表滚动到底部.

有谁知道这个,请帮助我,提前谢谢!

scroll uitableview ios

97
推荐指数
13
解决办法
9万
查看次数

iOS 7 TableView就像iPad上的设置应用程序一样

我想有风格同样喜欢iPad的设置应用程序的一组UITableView的详细视图用于iOS的7.

这是一个圆角的tableView.请查看附件了解详情.

是一些默认设置使它看起来像那样,或者我们需要为它做一些自定义绘图.

任何暗示正确的方向将不胜感激.

谢谢

在此输入图像描述

objective-c uitableview ipad ios ios7

97
推荐指数
4
解决办法
3万
查看次数

删除UITableView的单元格高亮颜色

我想删除uitableview单元格选择的默认蓝色.我不想要任何选择颜色.我还没有创建自定义单元类.我通过在其上添加标签和按钮来自定义单元格.我试过了

cell.selectioncolor = [UIColor clearcolor];
Run Code Online (Sandbox Code Playgroud)

但它说这种方法已被弃用.

有人可以帮帮我吗?

提前致谢.

objective-c uitableview ios

96
推荐指数
7
解决办法
7万
查看次数

UITableView行动画持续时间和完成回调

有没有办法既可以指定UITableView行动画的持续时间,也可以在动画完成时获取回调?

我想做的是在动画完成后闪烁滚动指示器.之前做闪光灯不会做任何事情.到目前为止,我的解决方法是延迟半秒(这似乎是默认的动画持续时间),即:

[self.tableView insertRowsAtIndexPaths:newRows
                      withRowAnimation:UITableViewRowAnimationFade];
[self.tableView performSelector:@selector(flashScrollIndicators)
                     withObject:nil
                     afterDelay:0.5];
Run Code Online (Sandbox Code Playgroud)

iphone animation cocoa-touch uitableview ios

96
推荐指数
7
解决办法
4万
查看次数

有没有办法在编辑UITableView时隐藏" - "(删除)按钮

在我的iphone应用程序中,我有一个处于编辑模式的UITableView,其中只允许用户对行进行重新排序,不给出删除权限.

那么有什么方法可以隐藏TableView中的" - "红色按钮.请告诉我.

谢谢

iphone cocoa uitableview ios

95
推荐指数
2
解决办法
3万
查看次数

如何在Storyboard中的UITableView中添加页脚

我是iOS开发的新手.

我想在一个表格视图中添加一个页脚UITableViewController.我已经在Storyboard中以图形方式使用了作为页脚的视图,但是我无法弄清楚如何将其作为页脚连接到我的表视图.

我可以以编程方式添加脚注UITableViewControllerviewDidLoad通过分配方法self.tableView.tableFooterView.但是我在Storyboard中创建了我的页脚视图,将它作为页脚添加到我的表视图的最佳实践方法是什么?

storyboard uitableview ios ios5

92
推荐指数
3
解决办法
5万
查看次数

UITableView禁用滑动删除,但在编辑模式下仍然有删除?

我想要类似于闹钟应用程序的东西,你不能滑动删除行,但你仍然可以删除编辑模式中的行.

当注释掉tableView:commitEditingStyle:forRowAtIndexPath:时,我禁止滑动删除并在编辑模式下仍然有删除按钮,但是当我按下删除按钮时会发生什么.叫什么?

cocoa-touch uitableview uikit ios

91
推荐指数
3
解决办法
7万
查看次数

是否可以将AutoLayout与UITableView的tableHeaderView一起使用?

因为我发现AutoLayout我到处都使用它,现在我正在尝试使用它tableHeaderView.

我做了subclass一些UIView添加的东西(标签等......)我想要他们的约束,然后我把它添加CustomViewUITableView' tableHeaderView.

一切都工作得很好,除了UITableView总是显示上面CustomView,通过以上我指的CustomViewUITableView,因此它不能被看到!

看来,无论我做什么,对heightUITableView" tableHeaderView始终 0(所以是宽度,x和y).

我的问题:如果不手动设置框架,是否可以完成此操作

编辑:我正在使用 的CustomView' subview有这些限制:

_title = [[UILabel alloc]init];
_title.text = @"Title";
[self addSubview:_title];
[_title keep:[KeepTopInset rules:@[[KeepEqual must:5]]]]; // title has to stay at least 5 away from the supperview Top
[_title keep:[KeepRightInset …
Run Code Online (Sandbox Code Playgroud)

iphone uitableview ipad ios autolayout

91
推荐指数
8
解决办法
6万
查看次数