Tag: uitableview

在故事板-IB中向原型单元添加项目时出现奇怪的错误

我有一个相当大的项目(〜20场景)。 其中之一是一个带有自定义UITableViewController类的TableViewController。 我给单元格重用标识符,并添加了一个标签。 当我尝试和Ctrl +拖动标签到UITableViewController头文件来创build一个sockets,我得到以下错误: 错误:非法configuration:连接“tableInfoView”不能有一个原型对象作为其目的地。 这是什么? 我可以忽略明显的东西吗? 或者我需要创build一个自定义的单元类,并将其拖到那个? 如果是这样的话,我怎样才能从UITableViewController中为每个单元格指定唯一显示的数据?

在iOS7中select单元格时,UITableView分隔线会消失

在我的tableView我设置单元格之间的分隔线。 我允许select多个单元格。 这里是我设置选定单元格背景颜色的代码: UIView *cellBackgroundColorView = [[UIView alloc] initWithFrame:cell.frame]; [cellBackgroundColorView setBackgroundColor:[UIColor darkGray]]; [cell setSelectedBackgroundView:cellBackgroundColorView]; 问题是,如果select了两个相邻的单元格,则在iOS7中它们之间没有分隔线,而在iOS6中有(如预期的那样)。 我什至尝试设置cellBackgroundColorView的框架高度cell.frame – 1.0 ,但也不起作用。 有任何想法吗?

如何在IOS7 UITableView中滚动到顶部?

在IOS6我有以下代码滚动到UITableView的顶部 [tableView setContentOffset:CGPointZero animated:YES]; 在IOS7中,这不起作用了。 表视图不完全滚动到顶部(但几乎)。

改变所选单元格的背景颜色?

有谁知道如何改变使用UITableViewCell单元的背景颜色,为每个选定的单元格吗? 我在TableView的代码中创build了这个UITableViewCell。

types'ViewController'不符合协议'UITableViewDataSource'

开始练习迅速。 在singleViewController我试图做一个UITableView 。 在故事板中,我设置了数据源和委托。 这里我得到错误*'ViewController'不符合协议'UITableViewDataSource'* class ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate { @IBOutlet weak var table: UITableView! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } } func numberOfSectionsInTableView(tableView: UITableView!) -> […]

UITableView中的声明失败configureCellForDisplay:forIndexPath:

我不确定错误在哪里,看过其他类似的问题。 我收到一个断言失败。 Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath: 我认为这是简单的,但希望有人可以帮助。 以下是我的代码: #import "StockMarketViewController.h" @interface StockMarketViewController () @end @implementation StockMarketViewController @synthesize ShareNameText, ShareValueText, AmountText; @synthesize shares, shareValues; – (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section; { return [shares count]; } – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath; { UITableViewCell * cell = […]

如何获得UICollectionViewCell的矩形?

UITableView有方法rectForRowAtIndexPath:但是在UICollectionView中不存在。 我正在寻找一个很好的干净的方式来抓住一个单元格的边界矩形,也许我可以添加一个UICollectionView类别。

在Swift中刷新基于Int的UITableView的某一行

我是Swift的开始开发人员,我正在创build一个包含UITableView的基本应用程序。 我想刷新表中的某一行使用: self.tableView.reloadRowsAtIndexPaths(paths, withRowAnimation: UITableViewRowAnimation.none) 我想要刷新的行是来自一个Int命名的rowNumber 问题是,我不知道该怎么做,我search的所有线程都是Obj-C 有任何想法吗?

UITableView单元格与背景图像

我有一个UITableView,其中3个图像。 1为选定的单元格,1为单元格背景,1为TableView背景。 我select的单元格工作得很好,但在正常单元格和TableView背景(当您向下滚动/向上滚动时单元格背后的背景) 有人可以帮助我为每个单元格的背景和一个TableView背景? 这是怎么做的? 正常细胞背景:(不知道是否正确) // CELL'S BACKGROUND-IMAGE self.tableView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"cell_normal.PNG"]]; 选定单元格背景: // SELECTED CELL'S BACKGROUND-IMAGE UIView *viewSelected = [[[UIView alloc] init] autorelease]; viewSelected.backgroundColor = [UIColor colorWithPatternImage: [UIImage imageNamed:@"cell_highlighted.PNG"]]; cell.selectedBackgroundView = viewSelected;

initwithstyle:reuseIdentifier:未调用

我创build自己的自定义UITableViewCell作为原型单元格的后端。 在我的课,我重写initwithstyle:reuseIdentifier:方法来做一些自定义的初始化,但我的初始化没有被调用。 我在它的第一行有一个断点,以及dequeueResusableCellWithIdentifier:一个断点。 dequeueResusableCellWithIdentifier:方法被调用,它返回一个初始化的单元格,但initwithstyle:reuseIdentifier:中的initwithstyle:reuseIdentifier:没有到达。 任何帮助将是伟大的。