jjzjj

indexPath2

全部标签

objective-c - 无法在 uicollectionview、UICollectionView 的特定 indexPath.row 处为单元格设置标题

在处理UICollectionView时,我正在从nib加载一个单元格,如下所示-(void)viewDidLoad{[superviewDidLoad];/*Uncommentthisblocktousenib-basedcells*/UINib*cellNib=[UINibnibWithNibName:@"NibCell"bundle:nil];[self.collectionViewregisterNib:cellNibforCellWithReuseIdentifier:@"cvCell"];//ConfigurelayoutUICollectionViewFlowLayout

ios - 您如何获得正在点击的单元格的 indexPath?

我正在尝试在长按UITableView中的单元格时执行IBAction。该操作涉及单元格的内容,因此我需要获取indexPath以便从本地存储中的字典中检索内容。IBAction方法在MasterViewController.m文件中定义,该文件包含UITableView方法并且是UITableViewController的子类。我已经尝试了以下所有方法,它们都返回null而不是单元格的indexPath。UITableViewCell*cell=(UITableViewCell*)self;NSIndexPath*indexPath=[self.tableViewindexPathF

iphone - [indexPath 行] 中的 EXC_BAD_ACCESS

我正在自定义我的表格单元格。我有这段代码(简化),它在尝试访问[indexPathrow]时给我一个EXC_BAD_ACCESS-(UITableViewCell*)tableView:(UITableView*)tableViewcellForRowAtIndexPath:(NSIndexPath*)indexPath{staticNSString*CellIdentifier=@"WCFPictureCell";staticNSString*CellNib=@"WCFPictureCell";WCFPictureCell*cell=(WCFPictureCell*)[tableVi

ios - indexPath 处 Row 的高度抛出 EXC Bad Access 错误

因此,当我输入下面的if语句时,我收到了EXCBadAccess错误。令人沮丧的是,我已经确认indexPath和tableView指向正确的位置。此外,完全相同的if语句在同一实现文件中我的代码的其他地方使用,没有错误。非常感谢您的帮助。-(CGFloat)tableView:(UITableView*)tableViewheightForRowAtIndexPath:(NSIndexPath*)indexPath{if([indexPathrow]==([tableViewnumberOfRowsInSection:[indexPathsection]]-1)){return44.

ios - 没有获取用于在 UITableViewCell 中点击 UISwitch 的 indexPath

我在UITableViewCell中添加了一个UISwitch,table内容是动态的,这意味着一个tableview中可能有很多UISwitch,我需要为每个UITableViewCell获取UISwitch状态,但没有获取indexPathaccessoryButtonTappedForRowWithIndexPath方法中的。我的代码是:-(UITableViewCell*)tableView:(UITableView*)tableViewcellForRowAtIndexPath:(NSIndexPath*)indexPath{LocationCell*cell=(Locati

ios - 比较行数和 indexpath.row

嗨,这是非常简单的事情,但由于某种原因让我很痛苦。我想将indexPath.row与总行数进行比较:NSInteger*rowCount=(NSInteger*)[self.tableViewnumberOfRowsInSection:indexPath.section];if((NSInteger*)indexPath.row但出于某种原因,这不起作用。有正确的方法吗? 最佳答案 在此代码中不需要任何指针或强制转换。您只是比较和存储整数值而不是对象或其他任何东西。请记住NSInteger是一种“原始”类型而不是对象。NSInteg

ios - UITableView selected indexpath 值给错

团队,我有UITableView,其中包含50多个单元格。每个单元格的宽度为60。当我滚动到20个单元格时,然后点击任何单元格它给出单元格值上方的索引路径值而不是单击单元格值在CellForRowAtIndexPath内部-(UITableViewCell*)tableView:(UITableView*)tableViewcellForRowAtIndexPath:(NSIndexPath*)indexPath{[[cellcheckButton]addTarget:selfaction:@selector(checkButtonAction:)forControlEvents:UI

ios - - (UITableViewCell *)tableView :(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath is not being called

所以这真的很奇怪......我有一个名为ListEventsViewController的ViewController在头文件中:@interfaceListEventsViewController:UIViewController@property(weak,nonatomic)IBOutletUITableView*eventsTable;@property(strong,nonatomic)NSArray*events;@end在实现中,我调用了以下几乎所有必需的函数:-(NSInteger)tableView:(UITableView*)tableViewnumberOfRow

ios - UITableView indexPath.row 问题

我正在使用一个tableView,它加载一个自定义的UITableViewCell,里面有一个“Tap”按钮。当用户点击按钮时调用一个方法。-(UITableViewCell*)tableView:(UITableView*)tableViewcellForRowAtIndexPath:(NSIndexPath*)indexPath{...[btnRowTapaddTarget:selfaction:@selector(didButtonTouchUpInside:)forControlEvents:UIControlEventTouchDown];...returncell;}在di

ios - UICollectionView cellForItemAtIndexPath indexPath 行为零

我第一次使用UICollectionView。我正在尝试获取每个单元格的“行”值-用作单元格文本字段的标识符/标签。当调用cellForItemAtIndexPath时,似乎[indexPathrow];返回nil。当行为零时,如何获取单元格索引(或用作标识符的其他内容)?注意使用iOS7,如果这有什么不同......-(UICollectionViewCell*)collectionView:(UICollectionView*)collectionViewcellForItemAtIndexPath:(NSIndexPath*)indexPath{//ReturnsnilNSLog