Tag: 可用的视图

设置自定义的UITableViewCells高度

我正在使用一个custome UITableViewCell有一些标签,button和图像显示。 单元格中有一个标签,其文本是NSString对象,string的长度可以是可变的。 由于这个原因,我不能在UITableViews: heightForCellAtIndex方法中为单元格设置一个不变的高度。 单元格的高度取决于可以使用NSStrings sizeWithFont方法确定的标签高度。 我尝试过使用它,但看起来我在某处出错了。 如何解决? 这里是用于初始化单元格的代码。 if (self = [super initWithFrame:frame reuseIdentifier:reuseIdentifier]) { self.selectionStyle = UITableViewCellSelectionStyleNone; UIImage *image = [UIImage imageNamed:@"dot.png"]; imageView = [[UIImageView alloc] initWithImage:image]; imageView.frame = CGRectMake(45.0,10.0,10,10); headingTxt = [[UILabel alloc] initWithFrame: CGRectMake(60.0,0.0,150.0,post_hdg_ht)]; [headingTxt setContentMode: UIViewContentModeCenter]; headingTxt.text = postData.user_f_name; headingTxt.font = [UIFont boldSystemFontOfSize:13]; headingTxt.textAlignment = UITextAlignmentLeft; headingTxt.textColor = [UIColor […]

是否有可能刷新UITableView中的单个UITableViewCell?

我有一个使用UITableViewCell自定义的UITableView 。 每个UITableViewCell有2个button。 单击这些button将更改单元格内的UIImageView的图像。 是否可以单独刷新每个单元格以显示新图像? 任何帮助表示赞赏。

如何在UITableViewCell之间添加间距

有什么办法可以在UITableViewCell之间添加空格吗? 我创build了一个表,每个单元格只包含一个图像。 图像被分配给这样的单元格: cell.imageView.image = [myImages objectAtIndex:indexPath.row]; 但是这使得图像放大并适合整个细胞,图像之间没有间隔。 或者可以这样说,图像的高度是例如50,并且我想在图像之间增加20个间距。 有什么办法可以做到这一点?

如何将button放在UITableView上,它不会在iOS中随表格滚动

我想把button放在UITableView ,它保持在屏幕的相同位置,不会用UITableView滚动。 当我试图添加子addSubviewbutton时,它们显示,但与UITableView滚动。 把button放在UITableView原因是让用户对它进行一些操作。 我不是在说细胞中有button。 他们是浮动的button,从不移动他们的位置。 我正在使用UITableViewController ,我不想使用页眉或页脚来达到此目的。 另外一些酒吧(例如UIToolbar )不是我的select。 提前致谢。

dequeueReusableCellWithIdentifier中的断言失败:forIndexPath:

所以我正在为我的学校做一个RSS阅读器,并完成了代码。 我跑了测试,它给了我这个错误。 这里是它所指的代码: – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier]; } 这是输出中的错误: 2012-10-04 20:13:05.356读者[4390:c07] *声明失败 – [UITableView dequeueReusableCellWithIdentifier:forIndexPath:],/SourceCache/UIKit_Sim/UIKit-2372/UITableView.m:4460 2012-10-04 20: 13:05.357阅读器[4390:c07] *由于未捕获的异常'NSInternalInconsistencyException',原因:'无法使用标识符Cell出列单元 – 必须为标识符注册一个nib或类,或者连接一个故事板中的原型单元“*第一掷调用堆栈:(0x1c91012 0x10cee7e 0x1c90e78 0xb64f35 0xc7d14 0x39ff 0xd0f4b 0xd101f 0xb980b 0xca19b […]