expandtabview用法 什么时候 reload

登录后方可回复
谢谢,但是这个是我现在正在用的方法,这个方法的问题是即使设置成AnimationNone也会有一个展开动画&希望把动画去掉变成reload那个瞬间刷新的形式。直接用reload又不知道怎么得到刷新结束事件&&
登录后方可回复
Then you should not use the internal table view insert function. You should create your own insert function to change the sectionArray value of the table and the call reloadData directly.
You can monitor the last cell of the table is prepared by this del
登录后方可回复
sectionArray是我的数据数组吧,那这个意思是加载到最后一个数据时显示reload结束?这不对吧,如果我数据很多的话一次只能加载有限个数的cell啊,到不了[sectionArray count]-1的位置吧?
登录后方可回复
另外我看到可以把列表的展开项置顶,展开内容能够在置顶项之下滚动直到碰到下一个展开项,很强大,这个是怎么做到的?
登录后方可回复
额,明白了,就是把section换一个自定义View跟列表很像而已&
登录后方可回复
I think that the delay 0.5s is enough for the tableView reloadData, if you want to have exactly call back of reloadData, you should create your own table view to inherit UITableView and then overwrite the reloadData function to add the call back, you can
登录后方可回复
[historyData enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
[datasource insertObject:obj atIndex:idx];
[self.tableView reloadData];
登录后方可回复
登录后方可回答6858人阅读
UITableView和UIScrollView(3)
1、UItableView设置偏移量
通过设置tableView的偏移量,让列表默认滚动到某个位置,内涵段子里面的效果
[myTableView setContentOffset:CGPointMake(0, 100) animated:YES];
2、刷新某行cell的方法
有时候只需要刷新某行的cell的数据,完全没必要调用[tableView reloadData]刷新整个列表的数据,调用以下方法即可。。
NSIndexPath *indexPath_1=[NSIndexPath indexPathForRow:1 inSection:0];
NSArray *indexArray=[NSArray
arrayWithObject:indexPath_1];
[myTableView
reloadRowsAtIndexPaths:indexArray withRowAnimation:UITableViewRowAnimationAutomatic];
3、改变分组列表之间的间距
改变每一组之间的间距
self.tableView.sectionHeaderHeight = 5;
self.tableView.sectionFooterHeight = 0;方法二
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
UIView *view = [[UIView alloc] initWithFrame:CGRectZero];
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
UIView *view = [[UIView alloc] initWithFrame:CGRectZero];
4、iOS7上tableView的分割线左边间距为0
ios7里面tableViewCell上面的分割线,左边少了20个像素,用下面的方法,可以让分割线完整显示出来
if ([_tableView respondsToSelector:@selector(setSeparatorInset:)]) {
           [_tableView setSeparatorInset:UIEdgeInsetsZero];
       }
5、设置tableview的cell颜色
//方法一:
cell.contentView.backgroundColor = [UIColor redColor];
//方法二:
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
UIView* bgview = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 1, 1)];
bgview.opaque = YES;
bgview.backgroundColor = [UIColor orangeColor];
[cell setBackgroundView:bgview];
//方法三:
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
cell.backgroundColor = [UIColor redColor];
6、调整cell之间的距离
#pragma mark 重写setFrame方法,自己调整cell的frame
- (void)setFrame:(CGRect)frame
// tableView边框的宽度 #define kTableBorderWidth 5
// 更改x、宽度
frame.origin.x = kTableBorderW
frame.size.width -= kTableBorderWidth * 2;
// 更改顶部间距、每个cell之间的间距
frame.origin.y += kTableTopBorderW
frame.size.height -= kTableViewCellM
[super setFrame:frame];
7、cell选中和不选中显示不通背景
cell.selectedBackgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@&choose_item_selected.jpg&]];
cell.backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@&choose_item.jpg&]];
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:767722次
积分:7375
积分:7375
排名:第1742名
原创:187篇
转载:133篇
评论:332条objective c - ios TableView reloadData - Stack Overflow
to customize your list.
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.
J it only takes a minute:
Join the Stack Overflow community to:
Ask programming questions
Answer and help your peers
Get recognized for your expertise
Hey I have a problem with my tableView. I fetch data from the server via NSURLSessionDataTask and when its finish I reload the table view. But I only see the data after I touch the display.
this is the code.
NSMutableURLRequest * request = [NSMutableURLRequest requestWithURL:url];
request.HTTPMethod = @"GET";
[request addValue:@"application/json" forHTTPHeaderField:@"Accept"];
NSURLSessionDataTask * dataTast = [session dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error == nil) {
tableViewArray = [NSJSONSerialization JSONObjectWithData:data options:1 error:nil];
[self.tableView reloadData];
[self.tableView setNeedsDisplay];
[dataTast resume];
I set the dataSource and the delegate in the Storyboard.
Is this not possible?
Put the [self.tableView reloadData]; on main thread.All UI must be updated on main thread.As tableview is not reloading when you call the [self.tableView reloadData];.But when you scroll tableView it gets updated data.Put the [self.tableView reloadData]; on main thread.
NSURLSessionDataTask * dataTast = [session dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error == nil) {
tableViewArray = [NSJSONSerialization JSONObjectWithData:data options:1 error:nil];
dispatch_async(dispatch_get_main_queue(), ^{
[self.tableView reloadData];
Also no need to call [self.tableView setNeedsDisplay];
12.3k24152
Your Answer
Sign up or
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Post as a guest
By posting your answer, you agree to the
Not the answer you're looking for?
Browse other questions tagged
Stack Overflow works best with JavaScript enabled}

我要回帖

更多关于 appcan tabview 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信