草庐IT

cell_value

全部标签

ios - 将单元格数据(即 cell.textlabel.text 和 cell.imageView.image)传递给另一个 View Controller

我有一个填充了数据(文本和图像)的UITableView。当用户点击特定的行项目时,它将转到detailViewController,它将所选行项目的文本和图像填充到下一个ViewController中。我正在使用prepareForSegue而不是didSelectRowAtIndexPath。titleForRow:indexPath.rowin:indexPath.section和imageForRow:...方法用于填充每个行项目的标题(cell.textLabel.text)和图像(cell.imageView.image)。我没有使用数据模型,因为这只是一个显示在detai

ios - 在自定义 Tableview Cell 中推送 ViewController

我正在使用UsingCustomizetablecell并在该单元格中有一个按钮操作,点击它应该会带我到另一个ViewController,我在按钮操作中使用此代码但它没有工作:PhotoViewController*photo=[[PhotoViewControlleralloc]initWithNibName:@"PhotoViewController"bundle:nil];[self.navigationControllerpushViewController:photoanimated:YES]; 最佳答案 得到解决方案:

ios - NSLayoutConstraint 获得真正的值(value)

如何获取大于等于的实际值NSLayoutConstraint。当你得到constant参数时,当运行时的约束明显超过它时,它仍然返回可能的最低值 最佳答案 如果您想要实际值,只需查看View的frame。是的,当使用自动布局时,您不应该手动更改frame,但如果您想查看View的位置,只需检查frame属性即可。 关于ios-NSLayoutConstraint获得真正的值(value),我们在StackOverflow上找到一个类似的问题: https://

ios - [cell addSubview :button] and [cell. contentview addsubview:button] 之间有什么区别

我在tableviewcell中有按钮。[celladdSubview:button]和[cell.contentviewaddsubview:button]有什么区别?因为当我在tableview中使用[celladdSubview:button]时,按钮功能工作正常但我在tableview中的界面搞砸了,在我ScrollView并返回tableview后按钮转到左侧单元格。另一方面,当我使用[cell.contentviewaddsubview:button]按钮功能不起作用并且没有任何内容保存到myarray。按钮代码:UIButton*button=(UIButton*)[ce

iOS6 崩溃 : this class is not key value coding-compliant for the key

这个问题在这里已经有了答案:Xcode-Howtofix'NSUnknownKeyException',reason:…thisclassisnotkeyvaluecoding-compliantforthekeyX"error?(78个答案)关闭7年前。我在iOS6设备而非iOS7设备上运行时发生崩溃。我有一个带有xibLanguageCell.xib的自定义UITableViewCell。它有2个标签、一个按钮和一个View。我有一个LanguageCell类,其中有4个IBOutlets:@interfaceLanguageCell:UITableViewCell@propert

ios - UICollectionView scrollToItemAtIndexPath : and get fresh cell position

我想将CollectionView滚动到某个没有动画的屏幕外单元格,并在滚动后获取该单元格的位置。问题是CollectionView(视觉上)正确滚动,但单元格框架保持在屏幕外。这是我的代码:NSIndexPath*path=[fetchedResultsControllerindexPathForObject:objectInCollection];[collectionViewscrollToItemAtIndexPath:pathatScrollPosition:UICollectionViewScrollPositionCenteredVerticallyanimated:NO

ios - 将 attributedText 分配给 UILabel 会使应用程序崩溃并返回 'NSConcreteMutableAttributedString initWithString::nil value'

这是我的tableViewCell代码的实现,我在这里所做的只是从我的MainViewController获取数据并将其分配给两个不同的UILabel。问题出在UILabel*subTitle中,当我使用attributedText分配它以传递所需的行间距时,应用程序在我滚动tableView后崩溃。但是,如果我简单地为它分配一个.text=它运行良好,不会崩溃。@property(strong,nonatomic)IBOutletUILabel*title;@property(strong,nonatomic)IBOutletUILabel*subTitle;-(void)confi

ios - 解决 "' NSUnknownKeyException',原因:This class is not key value coding-compliant for the key X” exception

我遇到了与此提交中确定的完全相同的问题:MvvmCross/Xamarin"Thisclassisnotkeyvaluecoding-compliantforthekey"问题源于尝试在IOSCollectionView中使用MVVMCross数据绑定(bind)那篇文章已关闭并标记为重复,但我不这么认为。它作为解决方案链接到的文章提供了使用XCode作为开发环境时的解决方法。我的场景和上面链接的问题中描述的场景是在Windows上使用VisualStudio和Xamarin进行构建。使用VisualStudio,XIB编辑器和连接socket的方式有所不同。几天来我一直在努力解决这个

ios - 在 UITableView 的自定义 Prototype Cell 中,UITextField 值替换为其他 Prototype Cell

我使用了一个UITableView并在其中使用了2个prototype单元格,现在在那些原型(prototype)单元格中,我使用了1个UITextField.现在,当我运行应用程序并在第一个原型(prototype)单元格中输入值时,我滚动UITableView,然后第一个原型(prototype)单元格的文本字段值变为最后一个原型(prototype)单元格的文本字段值。所以每次我向下滚动或向上滚动时它都会替换。有时它会变成空白。这是我的代码-(UITableViewCell*)tableView:(UITableView*)tableViewcellForRowAtIndexPa

iOS : What is the need of register cell before dequeuing in UITableView?

我经历了以下讨论:https://developer.apple.com/reference/uikit/uitableviewdatasource/1614861-tableviewhttps://developer.apple.com/reference/uikit/uitableview/1614937-registerhttps://developer.apple.com/reference/uikit/uitableview/1614891-dequeuereusablecellhttps://developer.apple.com/reference/uikit/uitab