Tag: uitableview

TableView单元格video自动播放

我所做的: 当单元格完全可见时,我添加了播放video的代码,当我向下或向上滚动时,再次重新载入tableview并再次播放video。 但是,我的要求是不同的。 我真正想要的是: 我想播放一个video,直到完全可见的向后或向前的单元格。 当用户向下滚动或向上滚动时,不会影响直到完全可见的向后或向前单元格。 devise Table Cell Layout Description -> Video Table Cell (Fix height 393) -> Content View -> Main view – (as per Content view of Table view Cell) -> Title View (0, 0, MainView.width, 57) -> Video View (0, 57, MainView.width, 200); -> Description View (0, 257, MainView.width, 136) 编码: […]

UITableView使用Swift

我的TapCell1.swift 这是自定义的UITableViewCell View import UIKit class TapCell1: UITableViewCell { @IBOutlet var labelText : UILabel init(style: UITableViewCellStyle, reuseIdentifier: String!) { println("Ente") super.init(style: UITableViewCellStyle.Value1, reuseIdentifier: reuseIdentifier) } override func setSelected(selected: Bool, animated: Bool) { super.setSelected(selected, animated: animated) } } 我的ViewController.swift 它的所有数据源和委托都设置正确。但我的自定义单元格不显示。 import UIKit class NextViewController: UIViewController, UITableViewDelegate, UITableViewDataSource { @IBOutlet var label: UILabel @IBOutlet var tableView : […]

UITableView单元格的dynamic高度问题(Swift)

可变长度的dynamic文本被注入tableview单元格标签。 为了使tableview单元的高度dynamicresize,我已经在viewDidLoad()实现了: self.tableView.estimatedRowHeight = 88.0 self.tableView.rowHeight = UITableViewAutomaticDimension 这适用于尚未滚动的单元格(因为在滚动到单元格时调用UITableViewAutomaticDimention ),但不适用于在加载数据表格时初始呈现在屏幕上的单元格。 我试图简单地重新加载数据(如许多其他资源中所build议的): self.tableView.reloadData() 在viewDidAppear()和viewWillAppear()都是无济于事。 我迷路了..有谁知道如何让Xcode呈现最初加载在屏幕上的单元格的dynamic高度? 请让我知道,如果有更好的替代方法。

在UITableView IOS中select行时,多选checkMark

我有一个UITableView显示选中行时的复选标记。 问题是,当我在didSelectRowAtIndexPathselect一行并在所选行上添加复选标记时,它会添加一个复选标记。 这是我的代码 任何帮助将非常感激。 – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath]; // Configure the cell… cell.textLabel.text=[[Model.category objectAtIndex:indexPath.row] categoryName]; cell.imageView.image=[[Model.category objectAtIndex:indexPath.row]categoryImage]; //cell.detailTextLabel.text =@"Breve Descripción de la categoria"; return cell; } – (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ if ([self.tableView cellForRowAtIndexPath:indexPath].accessoryType == UITableViewCellAccessoryCheckmark) { [self.tableView cellForRowAtIndexPath:indexPath].accessoryType =UITableViewCellAccessoryNone; [self.cellSelected removeObject:indexPath]; }else { [tableView cellForRowAtIndexPath:indexPath].accessoryType=UITableViewCellAccessoryCheckmark; […]

点击SWIFT时,将打开和closuresUItableviewcell对勾

我正在做一个tableview 我希望能够点击每个单元格,当点击时,它会在单元格上显示一个复选标记 现在我有一些代码,使这项工作: // checkmarks when tapped func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { let section = indexPath.section let numberOfRows = tableView.numberOfRowsInSection(section) for row in 0..<numberOfRows { if let cell = tableView.cellForRowAtIndexPath(NSIndexPath(forRow: row, inSection: section)) { cell.accessoryType = row == indexPath.row ? .Checkmark : .None } } } 但是这段代码只select了一个段内的1个单元(我有5个段) 我需要它在任何地方select任何单元格 另外,当我拖动我的屏幕上下,我失去了复选标记 任何帮助将非常感激 viewcontroller.swift class ViewController: […]

如何得到UITableViewCell移动开始和结束的通知

我的iOS应用程序中有一个UITableView定期刷新。 用户也可以随时移动tableview行(tableview始终处于编辑模式)。 我想停止刷新计时器,当用户开始拖动一行,并在行被删除时再次启动它。 使用moveRowAtIndexPath最后一部分应该很容易,但是如何获得有关拖动启动的通知? 谢谢!

我怎么能区分UITableViewCell的哪个部分被点击

我用自定义的UITableViewCell创build了一个UITableViewCell 。 我的单元格包含左侧的一个UIImageView和右侧的UITextView 。 在UITableViewController里面,我在tableview cellForRowAtIndexPath设置了图像和文本。 一切都显示正常,但现在我需要实现didSelectRowAtIndex ,我需要区分单元格的UIImageView或UITextView已被点击。 比方说,点击图像代表删除操作和其他单元格编辑操作。

在Interface Builder中deviseUITableView的节标题

我有一个UITableView的xib文件,我想要使用委托方法tableView:viewForHeaderInSection:添加一个自定义节头视图。 有没有可能在Interface Builderdevise它,然后以编程方式更改它的一些子视图的属性? 我的UITableView有更多的节标题,所以在Interface Builder创build一个UIView并返回它不起作用,因为我不得不复制它,但没有任何好的方法。 存档和解除存档对UIImage不起作用,所以UIImageView将显示为空白。 另外,我不想以编程的方式来创build它们,因为它们太复杂了,所产生的代码将难以阅读和维护。 编辑1 :这是我的tableView:viewForHeaderInSection:方法: – (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { if ([tableView.dataSource tableView:tableView numberOfRowsInSection:section] == 0) { return nil; } CGSize headerSize = CGSizeMake(self.view.frame.size.width, 100); /* wrapper */ UIView *wrapperView = [UIView viewWithSize:headerSize]; wrapperView.backgroundColor = [UIColor colorWithHexString:@"2670ce"]; /* title */ CGPoint titleMargin = CGPointMake(15, 8); UILabel *titleLabel = [UILabel labelWithText:self.categoriesNames[section] […]

如何在屏幕底部定位UITableViewCell?

在UITableViewCell有一到三个UITableViewView 。 是否有一种方法可以在reloadData之后始终将单元放置在屏幕的底部? +—————-+ +—————-+ +—————-+ | | | | | | | | | | | | | | | | | | | | | | | +————+ | | | | | | | cell 1 | | | | | | | +————+ | | | | +————+ | | +————+ […]

如何回收从XIB创build的UITableViewCell对象?

我想使用XIB创build自定义的UITableViewCell,但我不知道如何使用UITableViewController的排队机制来回收它。 我怎样才能做到这一点? 伙计们,这个问题的目的是按照常见问题自我回答,虽然我喜欢真棒回答。 有一些upvotes,对待自己的啤酒。 我问这是因为一个朋友问我,我想把它放在StackOverflow上。 如果你有任何贡献,一切手段!