Tag: tableview

在一个pageViewController内部的tableView上滑动即可删除

我在pageViewController里面有一个tableView ,当在一个单元格上滑动以提供删除单元格的选项时,只有在某些情况下才会识别该手势,假设你非常迅速和积极地滑动。 我想这是因为它不确定滑动手势是为了pageView还是tableView 。 有没有一种方法可以明确确定滑动手势发生的位置,以便顺利显示删除button?

重新加载ios7中的tableView标头

我怎样才能不重新加载所有表? -(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { UIView *header; if(!self.searchBar) { self.searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 10, 270, kRowHeight)]; self.searchBar.delegate = self; self.searchBar.barStyle = UISearchBarStyleDefault; self.searchBar.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin; self.searchBar.barTintColor = [UIColor clearColor]; } if(!self.placeholderSearchBarView) { self.placeholderSearchBarView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 270, kSearchBarPlaceholderHeight)]; self.placeholderSearchBarView.backgroundColor = [UIColor colorWithWhite:0.9 alpha:0.7]; } if (self.showSearchBar) { for (UIView *v […]

尽pipe在标题视图中不是在表格视图的顶部分段控制

我怎样才能把一个分段控制在一个tableview之上。 我不希望它在导航控制器的标题视图,我不希望它滚动tableview。 有关我的意思的参考,请查看App Store应用程序,select类别,然后select任何类别。 在那里你会看到我正在寻找的分段控制。 “付费”,“免费”和“发布date”分段。 我使用的代码不是IB,所以如果你知道如何回答这个代码不是IB拖放。

用animation重新加载表格视图单元格(Swift)

有没有办法重新加载具有animation多个部分的特定UITableView单元格? 我一直在使用: self.TheTableView.reloadSections(NSIndexSet(index: 1), withRowAnimation: UITableViewRowAnimation.Right) 这虽然激活了该部分中的所有单元格。 另一种select是使用: self.TheTableView.reloadRowsAtIndexPaths(<#indexPaths: [AnyObject]#>, withRowAnimation: <#UITableViewRowAnimation#>) 编辑: 使用reloadRowsAtIndexPaths后 由于未捕获的exception“NSInternalInconsistencyException”而终止应用程序,原因是:“无效的更新:第1部分中的行数无效。更新(5)后现有节中包含的行数必须等于该节中包含的行数(4)加上或减去从该部分插入或删除的行数(0插入,0删除),加上或减去移入或移出该部分的行数(0移入,0移入出)。” 尝试通过将对象附加到数组中来find重新加载tableview的顺利方式。 在reloadRowsAtIndexPaths工作之前调用TheTableView.reloadData(),但animation是有问题的。 还有另一种方法吗?

表格单元没有被重用的索引path

这开始发生了蓝色。 任何想法:代码: CUSTOMCLASSNAME(我已经replace了实际的类名,因为它包含了客户端的名字) 初始化我的tableView: [self.tableView registerClass:[CUSTOMCLASSNAME class] forCellReuseIdentifier:[self reuseIdentifier]]; 在行的单元格中: 嗨,标题正在打印在控制台。 这是我的cellForRow: – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { AVTCheckListTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:[self reuseIdentifier] forIndexPath:indexPath]; [self configureCell:cell atIndexPath:indexPath]; return cell; } – (void)configureCell:(AVTCheckListTableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath { ChecklistGroup *group = [self.checklistFetchedResultsController.fetchedObjects objectAtIndex:indexPath.section]; ChecklistItem *item = [self getChecklistItemForIndexPath:indexPath]; [cell setSelectionStyle:UITableViewCellSelectionStyleNone]; [[cell cellTextView] setAttributedText:[[item checked] boolValue] […]

有没有办法刷新单元格的高度没有重载/ reloadRow?

我做了一个像imessage一样的视图,只需将文本input到底部的文本视图。 我使用表视图来做到这一点,并在最后一个单元格中的文本视图。 当我input不止一行的长文本时,我需要文本视图和单元格变成尾部。 所以我需要刷新细胞的高度。 但如果我使用表视图的重新加载或重新加载行,文本视图中的内容将消失,键盘也将消失。 有没有更好的解决办法? 可能是我应该使用工具栏来做到这一点容易吗? 但我仍然怀疑表格视图可以做到这一点。

如何select地图引脚时,窃听与其关联的表格行?

在这里我有两个意见: WallViewController TableViewController WallViewController包含MKMapView, TableViewController是PFQueryTableViewController的子类, 用于显示与WallViewController上的注释引脚关联的内容行。 TableViewController作为WallViewController的子视图添加,所以这两个视图一起显示。 现在,当我点击地图上的注释引脚时, TableViewController中的tableview将滚动到与成功select的注释引脚关联的行。 但是我想要做的是也有一个相反的动作,所以当我点击一行时,与该行关联的注释引脚将被选中,并且其标注将被显示。 下面我提供了相关的代码: WallViewController.h @interface WallViewController : UIViewController <MKMapViewDelegate, CLLocationManagerDelegate> @property (nonatomic, strong) IBOutlet MKMapView *mapView; @end @protocol WallViewControllerHighlight <NSObject> – (void)highlightCellForPost:(PAWPost *)post; – (void)unhighlightCellForPost:(PAWPost *)post; @end WallViewController.m – (void)viewDidLoad { [super viewDidLoad]; self.tableViewController = [[TableViewController alloc] initWithStyle:UITableViewStylePlain]; [self addChildViewController:self.tableViewController]; self.tableViewController.view.frame = CGRectMake(6.0f, 215.0f, 308.0f, self.view.bounds.size.height – […]

如何dynamic扩展tableview中的单元格?

我只有一个cell ,在tableview有一个button。 cell高度定义在 tableView:tableView:heightForRowAtIndexPath: 细胞高度是40; 当我点击button时,如何将单元格高度更改为80? 谢谢你的帮助。

自定义单元格错误addTargetbutton

我创build了一个布局如下:在storyborad我有一个视图,包含一个表视图,我关联类TableViewController 。 然后,我创build了一个新的视图与自定义单元格,并分配给它的类CustomCell 。 当我尝试将操作分配给button时遇到问题。 由于各种原因,我需要在TableViewController中分配操作。 这是我的代码: 这是CustomCell: class CustomCategoryTableViewCell:UITableViewCell { @IBOutlet weak var customButton: UIButton! @IBOutlet weak var title: UILabel! override func awakeFromNib() { super.awakeFromNib() } override func setSelected(selected: Bool, animated: Bool) { super.setSelected(selected, animated: animated) println("Cell is selected.") } } 这是我的TableViewController: override func viewDidLoad() { super.viewDidLoad() // Register custom cell var nib = […]

UITableView滑动手势需要接近完美的准确性

我正在使用自定义UITableViewCell子类的UITableView自定义刷卡事件。 我在头中包含了UIGestureRecognizerDelegate ,并在viewDidLoad:有这个viewDidLoad: UISwipeGestureRecognizer *swipeLeft = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(didSwipe:)]; swipeLeft.direction = UISwipeGestureRecognizerDirectionLeft; swipeLeft.numberOfTouchesRequired = 1; [self.tableView addGestureRecognizer:swipeLeft]; 我的swipeLeft方法看起来像这样: -(void)didSwipe:(UISwipeGestureRecognizer *)recognizer { if (recognizer.state == UIGestureRecognizerStateEnded) { CGPoint swipeLocation = [recognizer locationInView:self.tableView]; NSIndexPath *swipedIndexPath = [self.tableView indexPathForRowAtPoint:swipeLocation]; NSDictionary *clip = [self.clips objectAtIndex:swipedIndexPath.row]; NSLog(@"Swiped!"); } } 这是有点工作,但刷卡必须非常精确。 像几乎不可能的精确。 我几乎通过使用UIPanGestureRecognizer来解决这个问题,但不幸的是,对于使用全局平移手势识别器的全局侧面抽屉组件(对于那些感兴趣的人来说,ECSlidingViewController)并没有很好的解决方法。 有没有办法解决? 任何帮助将不胜感激,因为我一直在search和浏览几个小时寻找解决scheme。