Tag: 可用的视图

有没有办法更新单个UITableViewCell的高度,而无需重新计算每个单元格的高度?

我有一个UITableView与几个不同的部分。 一个部分包含单元格,当用户将文本input到UITextView中时将调整其大小。 另一部分包含呈现HTML内容的单元格,对此,计算高度相对较为昂贵。 现在,当用户inputUITextView时,为了获得表视图来更新单元格的高度,我打电话给 [self.tableView beginUpdates]; [self.tableView endUpdates]; 但是,这导致表格重新计算表格中每个单元格的高度,当我真的只需要更新input到的单个单元格。 不仅如此,而不是使用tableView:estimatedHeightForRowAtIndexPath:来重新计算估计的高度,而是为每个单元调用tableView:heightForRowAtIndexPath:即使那些不被显示的单元。 有没有什么办法可以让表格视图更新一个单元格的高度,而不用做所有这些不必要的工作? 更新 我仍然在寻找解决scheme。 build议,我已经尝试使用reloadRowsAtIndexPaths: ,但它看起来不会像这样工作。 调用reloadRowsAtIndexPaths:即使单行也仍然会导致为每行调用heightForRowAtIndexPath:即使cellForRowAtIndexPath:只会针对您请求的行调用。 实际上,它看起来像插入,删除或重新载入行的时候, heightForRowAtIndexPath:将针对表格单元格中的每一行调用。 我也试着把代码放在willDisplayCell:forRowAtIndexPath:来计算单元出现之前的高度。 为了这个工作,我需要强制表视图重新请求行的高度后,我做了计算。 不幸的是,调用[self.tableView beginUpdates]; [self.tableView endUpdates]; [self.tableView beginUpdates]; [self.tableView endUpdates]; from willDisplayCell:forRowAtIndexPath:在UITableView的内部代码中导致索引越界exception。 我猜他们不指望我们这样做。 我不禁觉得这是一个SDK中的错误,作为对[self.tableView endUpdates]响应,它不会调用estimatedHeightForRowAtIndexPath:对于不可见的单元格,但我仍然试图find某种解决方法。 任何帮助表示赞赏。

tableView:canEditRowAtIndexPath:当popupviewController时崩溃

我有一个UITableView viewController,我允许用刷卡编辑(删除)的行 – 很像邮件应用程序。 我这样做,除其他外,这种方法: – (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { return YES; } 但是,如果我有一个删除button显示,并在同一时间我使用我的UINavigationController后退导航,即当我popViewControllerAnimated:应用程序崩溃与以下消息: [ViewController tableView:canEditRowAtIndexPath:]:发送到释放实例0xaae64d0的消息 我该如何解决这个问题?

UIRefreshControl – 拉到iOS 7中刷新

我试图在我的表格视图中获取iOS 7的拉动function。 在我的viewDidLoad ,我有: refreshControl = [[UIRefreshControl alloc] init]; [self.mytableView setContentOffset:CGPointMake(0, refreshControl.frame.size.height) animated:YES]; [refreshControl beginRefreshing]; [refreshControl addTarget:self action:@selector(refreshTable) forControlEvents:UIControlEventValueChanged]; 然后我运行: -(void)refreshTable { [self.mytableView reloadData]; [refreshControl endRefreshing]; } 在iOS 6上,这意味着当你拉下桌子的时候,它会显示一个圆形的箭头,当你拉动的时候会拉长,拉到足够的时候会刷新。 现在,我看不到圆形箭头。 我错过了什么?

禁用uitableview突出显示,但允许select单个单元格

当你点击一个单元格的行被选中,并突出显示。现在我想要做的是禁用突出显示,但允许select。是否有解决方法。有问题的答案,但它禁用select和突出显示。

无法从其DataSource获取单元格

下面的代码有什么问题 -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; cell.textLabel.text = @"hello"; return cell; } 和 -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ return 2; } 但是我无法从dataSource中获取单元格 整个例外是 *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UITableView (<UITableView: 0x7ffe0b092800; frame = (0 97; 414 590); clipsToBounds = YES; autoresize = RM+BM; gestureRecognizers […]

我不想在开始更新animation,结束更新块为uitableview?

我有一个UITableView。 它使用自定义表格单元格,每个单元格都有一个uiwebview。 Bcoz UIWebView带着时间来加载,我想避免不惜一切代价重新加载它们。 在某些情况下,我已经加载了所有的单元格,但是它们的高度是混乱的。 因此,我需要“重新布局”表而不触发“cellForRow”function。 我绝对不能使用reloadData …因为它会重新加载单元格。 我试过tableView.setNeedDisplay,setNeedsLayout等,他们都不能重新排列表格单元格 唯一的办法就是调用beginupdates / endupdates块,这个块能够重新启动我的表而不会触发cellForRow! 但是,我不想要animation! 这个块产生一个animation效果,但我不想要它… 我该如何解决我的问题?

UITableView设置为静态单元格。 是否有可能以编程方式隐藏一些单元格?

UITableView设置为静态单元格。 是否有可能以编程方式隐藏一些单元格?

如何判断UITableVIew何时完成ReloadData?

我正在尝试滚动到UITableView完成后执行[self.tableView reloadData] 我原本是 [self.tableView reloadData] NSIndexPath* indexPath = [NSIndexPath indexPathForRow: ([self.tableView numberOfRowsInSection:([self.tableView numberOfSections]-1)]-1) inSection: ([self.tableView numberOfSections]-1)]; [self.tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionBottom animated:YES]; 但后来我读reloadData是asynchronous的,所以滚动不会发生,因为self.tableView , [self.tableView numberOfSections]和[self.tableView numberOfRowsinSection都是0。 谢谢! 有什么奇怪的是,我正在使用: [self.tableView reloadData]; NSLog(@"Number of Sections %d", [self.tableView numberOfSections]); NSLog(@"Number of Rows %d", [self.tableView numberOfRowsInSection:([self.tableView numberOfSections]-1)]-1); 在控制台中,它返回Sections = 1,Row = -1; 当我做了完全相同的NSLogs在cellForRowAtIndexPath我得到部分= 1和行= 8; (8是对的)

如何删除UITableView中的空单元格?

我想显示一些简单的UITableView数据。 我希望设置UITableView的静态高度,以便它不会在表的末尾显示空单元格。 我怎么做? 码: – (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { NSLog(@"%d", [arr count]); return [arr count]; }

带固定节头的UITableView

问候,我读到, UITableView的默认行为是将节标题行固定到表的顶部,当您滚动部分,直到下一部分将previos部分行推出视图。 我有一个UITableView里面的UIViewController ,这似乎并不是这种情况。 这仅仅是UITableViewController的默认行为吗? 这里有一些基于我所拥有的简化代码。 我将展示UIController接口和我已经实现的每个表视图方法来创build表视图。 我有一个帮助数据源类,帮助我索引我的对象与表一起使用。 @interface MyUIViewController ()<UITableViewDelegate, UITableViewDataSource> @property (nonatomic, readonly) UITableView *myTableView; @property (nonatomic, readonly) MyCustomHelperDataSource *helperDataSource; @end //when section data is set, get details for each section and reload table on success – (void)setSectionData:(NSArray *)sections { super.sectionData = sections; //this array drives the sections //get additional data for section […]