草庐IT

indexpath

全部标签

iOS 删除 tableview 行

我的应用程序在iOS6上运行良好。随着升级,我不再能够从UITableView中删除行。我的原型(prototype)单元格中有一个按钮。按钮的功能如下:-(IBAction)deleteCell:(id)sender{UIButton*btn=(UIButton*)sender;UITableViewCell*cell=(UITableViewCell*)btn.superview.superview;NSIndexPath*indexPath=[_tableViewindexPathForCell:cell];if([namescount]>9){intindex=indexPat

ios - 更新 tableView 时断言失败

注意:当我点击该行时,应用会崩溃。我正在尝试在用户点击时添加一个新单元格。我发现WWDC2011的表格View演示中有一个类似的例子。这是我的TableView中的代码。这里是错误:2013-03-1920:04:28.672Project[51229:c07]***Assertionfailurein-[UITableView_endCellAnimationsWithContext:],/SourceCache/UIKit_Sim/UIKit-2380.17/UITableView.m:1070这是我在TableView中的代码。@interfaceMyPFQueryTableVi

ios - 在重用 UITableViewCell 时使用 SDWebImage 处理图像下载

我使用第三方库SDWebImage为我的UITableView单元格下载图像,UIImageView是在单元格中创建的,并在像这样配置单元格时触发请求。[imageViewsetImageWithURL:[NSURLURLWithString:imageUrl]placeholderImage:[UIImageimageNamed:@"default.jpg"]completed:^(UIImage*image,NSError*error,SDImageCacheTypecacheType){}];它工作正常,但是当我快速滚动时,大多数图像没有完全下载(我可以在charles中看到),

ios - UICollectionView 滚动到一个项目

我正在尝试记住UICollectionView中的项目(indexPath.item)的索引,稍后,在替换并恢复View后,滚动到该内存的项目。在内存item时,indexPath、indexPath.item是:indexPathis:2indexes[0,32]indexPath.itemis:32稍后为该项目重新计算indexPath时,indexPath和indexPath.item是:indexPathis:2indexes[0,32]itemis:32我尝试使用以下方法滚动到内存的位置:NSIndexPath*iPath=[NSIndexPathindexPathForIt

ios - 'NSGenericException',原因 : Collection <__NSArrayM: 0x7fabb400> was mutated while being enumerated

在我的iPhone应用程序中,我正在尝试使用uicollectionView实现一个图片库。当错误:Terminatingappduetouncaughtexception'NSGenericException',reason:'***Collectionwasmutatedwhilebeingenumerated.'***Firstthrowcallstack:(0CoreFoundation0x042ea946__exceptionPreprocess+1821libobjc.A.dylib0x03660a97objc_exception_throw+442CoreFoundati

ios - 重新加载后无法取消选择 UICollectionView 单元格

我在使用UIcollectionView时遇到了一系列问题,我认为解决方法是当前导致问题的原因。好的,所以我有一个collectionview,它从一个更新非常频繁的类中加载对象,可能每隔几秒更新一次。我遇到的第一个问题;是当我选择一个单元格并将其突出显示时,CollectionView下方的另一个单元格也突出显示。我的解决方案是创建一个选定单元格数组,然后在新数组中运行一个循环来决定要突出显示的内容。现在,问题出现在重新加载collectionview时。这些单元格继续保持突出显示并显示为选中状态,但它们没有记录触摸,因此我无法取消选择它。-(NSInteger)collection

ios - appname.ViewsVC collectionView :cellForItemAtIndexPath:]: unrecognized selector sent to instance

我正在构建一个CollectionView并收到以下错误。Terminatingappduetouncaughtexception'NSInvalidArgumentException',reason:'-[appname.ViewsVCcollectionView:cellForItemAtIndexPath:]:unrecognizedselectorsenttoinstance这是我自定义单元格的代码//cellconfigurationfunccollectionView(_collectionView:UICollectionView,cellForItemAtindexPa

ios - 如何使用 Seque 在 tableView 中找到点击按钮的 indexPath

我有一个使用原型(prototype)单元格的UITableView。单元格有一个UIButton,它使用Segue显示UIViewController(模态)。我的问题是:如何将单元格的IndexPath传递给第二个ViewController-(void)prepareForSegue:(UIStoryboardSegue*)seguesender:(id)sender{if([segue.identifierisEqualToString:@"showGamerDetail"]){//itsnotworked:NSIndexPath*indexPath=[self._tableV

ios - UITableView - 不同部分的多选和单选

我有一个包含2个不同部分的UITableView。是否可以在一个部分进行多项选择,而在另一部分进行单选?如果我使用:self.tableView.allowsMultipleSelection=YES;它影响整个表。 最佳答案 我将展示我自己的解决方案,它与您发布的解决方案几乎相同。不过,我认为这要好一些,因为我手动管理选定的行,所以我可以稍后使用tableView.indexPathsForSelectedRows属性。它是用Swift2编写的。解决方案我首先声明一个NSIndexPath来存储之前选择的项目varindexPat

ios - UICollectionView didSelectRowAtIndexPath 不起作用

didSelectRowAtIndexPath方法在我的应用中不起作用。我没有使用NSLog打印任何输出:-(UICollectionViewCell*)collectionView:(UICollectionView*)collectionViewcellForItemAtIndexPath:(NSIndexPath*)indexPath{PhotoCell*cell=[collectionViewdequeueReusableCellWithReuseIdentifier:@"Cell"forIndexPath:indexPath];PFObject*imageObject=[se