Tag: 可用视图

UITableView部分周围的边框

我们如何可以在tableview的每个部分都有边框? 附上图片来显示我在找什么。 如果您查看图像,则每个tableview部分都有一个边框。

为TableView中的所有单元格设置标签的正确方法

我正在使用一个tableView中的button,当我按下时,我得到的indexPath.row 。 但是,当单元格可以在屏幕上显示而不scroll时,它才能正常工作。 一旦tableView可以滚动,我滚动tableview, indexPath.row返回是一个错误的值,我注意到,最初设置20个对象,例如Check只是打印9次没有20。 – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; lBtnWithAction = [[UIButton alloc] initWithFrame:CGRectMake(liLight1Xcord + 23, 10, liLight1Width + 5, liLight1Height + 25)]; lBtnWithAction.tag = ROW_BUTTON_ACTION; lBtnWithAction.titleLabel.font = luiFontCheckmark; lBtnWithAction.tintColor = [UIColor blackColor]; lBtnWithAction.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin; […]

iphone – didSelectRowAtIndexPath:只在长按自定义单元格后被调用

我正在创build一个基于表视图的应用程序。 我为表创build了一个自定义表格单元格,其中包含2个标签,1个图像和1个button。 表视图数据源方法正常工作。 我为自定义单元格和视图控制器类使用xib,并将委托和数据源连接到文件的所有者。 但问题是,当我select表行,didSelectRowAtIndexPath没有得到消防。 如上所述,唯一的办法是按住电池约3-4秒钟。 有谁知道为什么会发生这种情况? 感谢任何指针… 这是我的表格视图的方法.. – (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } – (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [finalAddonsArray count]; } – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; NewCustomCell *cell = (NewCustomCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { NSArray *nib=[[NSBundle mainBundle]loadNibNamed:@"NewCustomCell" owner:self options:nil]; cell=[nib objectAtIndex:0]; } […]

如何调整UITableViewCell的大小以适应其内容?

我有一个UITableview与多个可重用的TableViewCells。 在一个单元格中,我有一个UITextView ,它调整自己以适应其内容。 现在我只需要调整TableViewCell的contentView ,这样我就可以阅读while文本了。 我已经尝试过了: cell2.contentView.bounds.size.height = cell2.discriptionTextView.bounds.size.height; 要么: cell2.contentView.frame = CGRectMake(0, cell2.discriptionTextView.bounds.origin.y, cell2.discriptionTextView.bounds.size.width, cell2.discriptionTextView.bounds.size.height); 在该方法中: – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {} 但它不会工作。 有谁知道如何做到这一点? 新代码: @implementation AppDetail CGFloat height; … – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {… cell2.TextView.text = self.text; [cell2.TextView sizeToFit]; height = CGRectGetHeight(cell2.TextView.bounds); … } – (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { […]

静态和dynamic单元格的UITableView混合?

我知道你不能在单个UITableView混合静态和dynamic单元格types,但我想不出一个更好的方式来描述我的问题。 我有几个固定内容的预定义单元格,我也有一个未知数的dynamic内容单元格坐在中间。 所以我想我的桌子看起来像这样: Fixed Fixed Fixed Dynamic Dynamic Dynamic Dynamic Dynamic Fixed Fixed 那么你究竟如何build议我在我的cellForRowAtIndexPath方法呢? 谢谢。

具有两个自定义单元(多个标识符)的UITableView

我试图把一个单元格作为每个单元格之间的空间 – 这将通过设置alpha = 0隐藏。在我的表中,空间单元格将是奇数的行。 请注意,实际的单元格高度是85,但隐藏的单元格高度(即单元格之间的空间)是20。 问题是空间单元格高度是85,但不是20,我不知道为什么。 也许单元格没有正确加载。 这里的Cell是UITableViewCell – 实际单元格,标识符为“单元格”。 Cell2是标识符为“Space”的空间。 上面的每个类都有自己的UITableViewCell类,并且XIB文件也被分配给它们中的每一个。 标识符也在IB中为每个Xib设置。 – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier1 = @"Cell"; static NSString *CellIdentifier2 = @"Space"; Cell *cell = (Cell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier1]; if(!cell) { NSArray *ar = [[NSBundle mainBundle] loadNibNamed:@"CellView" owner:nil options:nil]; for (id obj in ar) { if ([obj […]