草庐IT

uitableviewcells

全部标签

ios - 如何避免 UITableViewCell 在 TableView 滚动时重复添加自定义标签?

我创建一个自定义单元格:#import#import"RecruitmentResumeEntity.h"@interfaceRecruimentListItemCell:UITableViewCell@property(nonatomic,strong)RecruitmentResumeEntity*entity;@end并且在.m文件中设置实体方法时,我添加了三个标签:-(void)setEntity:(RecruitmentResumeEntity*)entity{_entity=entity;floatlabelHeight=17;CGRectframe=CGRectMake(

ios - UITableViewCell - 更新 NSMutableDictionary 值

我有UITableViewController,它有类似Twitter的帖子和类似的按钮。我正在做的是,如果尝试通过+1更新点赞计数成功,则单击点赞按钮时。除了更新部分之外,我执行了上述所有方法。我收到Terminatingappduetouncaughtexception'NSInternalInconsistencyException',reason:'-[__NSCFDictionarysetObject:forKey:]:mutatingmethodsenttoimmutableobject'错误。这是我的代码。-(UITableViewCell*)tableView:(UIT

ios - 如何在自定义 UITableViewCell 中显示 Dictionary 中的数据?

我正在使用AFNetworking3.0。在ViewController中,我在每个单元格中显示了多个专业标题。点击特定单元格后,我从服务器收到如下响应:[{"dp":{"id":0,"qualification":"MD(Doctor)","reg_id":0,"specialization1":"Orthopaedics","specialization2":"Dermatologist","specialization3":"Neurology","url":"www.batras.com"},"ds":{"city":"agiripalle","consultation_fee

iphone - 如何设置 UITableViewCell 的高度

我知道当UIKit渲染一个单元格时,它使用tableView:heightForRowAtIndexPath:来计算高度。我的问题是,如何以及何时在实际的UITableViewCell上设置它。我想构建动态单元格,并且需要计算文本在单元格中的位置。我相信我可以只使用self.bounds和self.frame-我只是好奇它们是在什么时候设置的-即使使用dequeueReusableCellWithIdentifier。谢谢。 最佳答案 从tableView:cellForRowAtIndexPath:返回单元格后,tableview

iphone - UITableViewCell 中的 UITextField 在滚动时被删除

我在分组的UITableView中有一个小表单(5个字段)。每个UITextField都在UITableView单元格内。在文本字段中单击时,它会调出键盘,然后允许您将某些单元格滚动到View之外,当您将它们拉回时,它们的内容将被删除。我假设它们已被重绘,所以它们的内容消失了,这是否正确?如果是这样,防止这种情况的最佳方法是什么?由于我只有5个字段,当它们滚动回View时我是否必须重新绘制我的单元格?我正在重复使用细胞:staticNSString*CellIdentifier=@"Cell";UITableViewCell*cell=[tableViewdequeueReusable

iphone - 添加 subview 后,UITableViewCell contentView 框架大小会自动增加吗

添加subview后,UITableViewCellcontentView的帧大小会自动增加吗?假设你:向UITableViewCell内容View添加一些subview(例如UILabel的)然后使用label.frame=CGRectMake(...方法设置UILabel大小/位置那么UITableViewCell的框架大小是否会自动更改以适应这种情况-即,如果您转到tableViewCell.contentView.frame.size.height,这是否应该是刚好适合subview所需的总高度? 最佳答案 我不这么认为..

cocoa-touch - 动画 UITableViewCell ContentView 在进入编辑模式时淡出

我在iPhoneMail.app和SMS.app应用程序中注意到了这个功能,但我不确定自己如何实现它。在标准的UITableView中,当用户点击“编辑”按钮并且删除按钮移动到位时,随着内容View向右滑动,它们会执行快速的淡入淡出过渡,由它们自己的更薄版本替换(考虑到删除按钮占用的空间)。我最初认为这是通过在启用编辑模式时调用以下方法来完成的:[self.tableViewreloadRowsAtIndexPaths:[tableViewindexPathsForVisibleRows]withRowAnimation:UITableViewRowAnimationFade];然而,

iphone - UITableViewCell 附件在滚动出屏幕时消失

我有一个装满对象的UITableView。在didSelectRowAtIndexPath方法中,我有一个UITableViewCellAccessoryCheckmark在选中该行时出现,在未选中时消失。下面是didSelectRowAtIndexPath方法的代码:-(void)tableView:(UITableView*)tableViewdidSelectRowAtIndexPath:(NSIndexPath*)indexPath{[tableViewdeselectRowAtIndexPath:indexPathanimated:NO];UITableViewCell*cu

iphone - UITableViewCell 中的 UILabel autoresizingMask

我将UILabel添加到简单的UITableViewCell,但是当我将设备旋转到横向时,UILabel不会移动到右侧,即使myLabel.autoresizingMask=UIViewAutoResizingFlexibleRightMargin;它位于UITableViewCell的中间。在纵向模式下,myLabel位于UITableViewCell的右侧。这是代码:myLabel=[[UILabelalloc]initWithFrame:CGRectMake(252,12,60,20)];myLabel.font=[UIFontfontWithName:@"Helvetica"s

iphone - 我可以使用什么替代 switch 语句来更新我的 UITableViewCells?

这个问题在这里已经有了答案:关闭11年前。PossibleDuplicate:AlternativetoswitchstatementinobjectiveC我有来自url的json数据,我使用switch语句将其显示在表格单元格中。因为我只有6个单元格,所以我使用了switch语句,但我很想知道是否有任何其他方法可以代替switch语句来这样做。switch(indexPath.row){case0:cell.textLabel.text=[NSStringstringWithFormat:@"%@%@",[dictionaryvalueForKey:@"firstname"],[d