Tag: uitableview

UITablevlewCell中的UIImageView上的UITapGestureRecognizer没有被调用

我目前有一个自定义的UITableViewCell,其中包含一个UIImageView,并试图在UIImageView上添加一个UITapGestureRecognizer,没有运气。 这里是代码片段。 //within cellForRowAtIndexPath (where customer table cell with imageview is created and reused) UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleImageTap:)]; tap.cancelsTouchesInView = YES; tap.numberOfTapsRequired = 1; tap.delegate = self; [imageView addGestureRecognizer:tap]; [tap release]; // handle method – (void) handleImageTap:(UIGestureRecognizer *)gestureRecognizer { RKLogDebug(@"imaged tab"); } 我也设置了单元格和UIImageView的superview userInteractionEnabled,但仍然没有运气,任何提示? 编辑 : 我也删除单元格的select由cell.selectionStyle = UITableViewCellSelectionStyleNone; 这可能是一个问题

如何通过iOS中的参数将UITableView IndexPath传递给UIButton @selector?

我在UITableViewCells添加了UIButton 。 我有当用户点击button我们已经得到的indexpath使用NSMutableArray的值。 我用下面的来获取当前的IndexPath , [getMeButton addTarget:self action:@selector(resendTheErrorMessage:) forControlEvents:UIControlEventTouchUpInside]; -(void) resendTheErrorMessage:(id)sender { NSLog(@"SEnder: %@", sender); //NSLog(@"Index Path : %@", indexpath); } 任何人都可以请帮助我通过当前的indexpath UIButton's 。 提前致谢。 编辑: 这是我从NSLog()获得的输出 <UIButton: 0x864d420; frame = (225 31; 95 16); opaque = NO; tag = 105; layer = <CALayer: 0x864d570>>

UITableViewCell不使用废弃的方法initWithFrame:reuseIdentifier

我已经阅读了Loren的文章 ,为UITableViewCell绘制自己的内容。 但是,他正在使用不推荐使用的方法: initWithFrame:reuseIdentifier:在UITableViewCell上已弃用。 你如何让他的例子工作,而不使用initWithFrame:reuseIdentifier ?

dequeueReusableCellWithIdentifier永远不会返回nil

我在我的UITableView中使用自定义的UITableViewCell,但问题是,调用dequeueReusableCellWithIdentifier时,单元格永远不会为零。 为什么是这样 ? – (void)viewDidLoad { [super viewDidLoad]; UINib *nib = [UINib nibWithNibName:@"PHResultTableViewCell" bundle: nil]; [[self tableView] registerNib:nib forCellReuseIdentifier:@"MyCell"]; } – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { PHResultTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MyCell"]; if (cell == nil) { PackageHolidayItem *obj=[[PackageHolidayItem alloc]init]; obj= [totalArray objectAtIndex:indexPath.row]; cell.packageHolidayItem = obj; [cell loadRow]; } return cell; }

无法将types'UITableViewCell'的值转换为'(AppName)。(CustomCellName)'

我目前正在尝试使用xCode 6.3 swift 1.2创build自定义表格视图单元格。 出于某种原因在cellforRowAtIndexPath方法,我似乎无法设置我的单元格variables。 代码会编译,但是当这行代码命中时: var cell:MessageCell = tableView.dequeueReusableCellWithIdentifier("messageCell") as! MessageCell 我得到这个错误:无法将types'UITableViewCell'(0x1112f5a18)的值转换为'CampusExchange.MessageCell'(0x10e8318f0)。 以下是我的完整方法:(如果您想知道如何设置消息,我正在使用Parse) func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { var cell:MessageCell = tableView.dequeueReusableCellWithIdentifier("messageCell") as! MessageCell let message = messagesArray[indexPath.row]["Message"] as? String cell.messageOutlet.text = message return cell } 感谢您的任何帮助。 我似乎无法得到这个工作。

UITableView:处理混合单元格表格中的单元格select查看静态和dynamic单元格

我想在组合的表格视图中混合dynamic和静态单元格:我想在静态单元格的顶部有两个部分,后面跟着一部分dynamic单元格 (请参阅下面的屏幕截图)。 我已经将表格视图内容设置为静态单元格 。 编辑 基于AppleFreak的build议,我改变了我的代码如下: – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell; if (indexPath.section <= 1) { // section <= 1 indicates static cells cell = [super tableView:tableView cellForRowAtIndexPath:indexPath]; } else { // section > 1 indicates dynamic cells CellIdentifier = [NSString stringWithFormat:@"section%idynamic",indexPath.section]; cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier […]

两个UITableView在同一视图中

我想知道是否允许在同一个视图中使用多个UItableView (我没有看到苹果的人机接口指南中的任何东西),如果没关系,如何在每个UITableView viewDidLoad加载不同的DataSource ?

基于内容的dynamicUITableView单元格高度

我有一个UITableView填充自定义单元格(从UITableViewCellinheritance),每个单元格包含一个UIWebView ,根据它的内容自动resize。 这里的东西,我怎么能根据他们的内容(variableswebView )来改变UITableView单元格的高度。 解决scheme必须是dynamic的,因为用于填充UIWebViews的HTML从不断变化的提要中parsing。 我有一种感觉,我需要使用UITableView委托方法heightForRowAtIndexPath但从它的定义: – (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { ;//This needs to be variable } 我无法访问单元格或它的内容。 我可以在cellForRowAtIndexPath更改单元格的高度吗? 任何帮助将是伟大的。 谢谢。 注意 两年前我问过这个问题。 随着自动布局的介绍,iOS7的最佳解决scheme可以find: http://t.co/PdUywcTjhu 而在iOS8上,这个function是在SDK中构build的

accessoryButtonTappedForRowWithIndexPath:没有被调用。

我正在创build一个详细信息披露button,正在使用数组填充… ….如何在我的类中不被调用accessoryButtonTappedForRowWithIndexPath:函数。 它是一个tableviewdelegate和tableviewdatasource委托。 – (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath{ NSLog(@"reaching accessoryButtonTappedForRowWithIndexPath:"); [self performSegueWithIdentifier:@"modaltodetails" sender:[self.eventsTable cellForRowAtIndexPath:indexPath]]; } NSLog不打印到控制台,这导致我相信function不被称为…这当然是当我select一个单元格。 下面的屏幕截图显示了我的细胞设置。

标题和第一个单元格之间的分隔 – 在普通的UITableView

我有一个平原与只有一个部分的表。 我有一个实现viewForHeaderInSection:在部分标题中添加自定义视图。 我无法看到我的表节标题视图和我的第一个单元格之间的分隔线。 [见附图] 我究竟做错了什么?