草庐IT

IndexPath

全部标签

ios - 从 UITableView 播放视频

我的主要目标是能够点击表格View项目并加载视频。TableView填充了文档目录的内容,我已经能够成功地做到这一点并将文件名添加到单元格的标签中,我使用以下代码完成了此操作:void)viewDidLoad{[superviewDidLoad];NSArray*paths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);NSString*documentsDirectory=[pathsobjectAtIndex:0];//GetdocumentsfolderNSString*

c# - 获取从 UITableView 中选择的行?

在我的XamariniOS应用程序中,我有以下代码:publicclassTableSource:UITableViewSource{publicoverridevoidRowSelected(UITableViewtableView,NSIndexPathindexPath){newUIAlertView("RowSelected",TableItems[indexPath.Row],null,"OK").Show();}}每当用户选择一个新单元格时,这会成功发送一个警报,但是我希望能够从我的ViewController中调用此方法或类似方法。基本上这样我就可以单击一个按钮,它会返回

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

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

ios - 下载缩略图后重新加载 UItableViewCell

我有一个应用程序,在其中的tableViewCell中下载图像并将其设置为缩略图。我的问题是,我可以看到缩略图刷新的唯一方法是单击另一个选项卡,然后返回到tableViewCell所在的选项卡。下面是设置缩略图的代码。-(UITableViewCell*)tableView:(UITableView*)tableViewcellForRowAtIndexPath:(NSIndexPath*)indexPath{staticNSString*cellIdentifier=@"Cell";UITableViewCell*cell=[tableViewdequeueReusableCellW

ios - 尝试从 UITableView 中删除行时断言失败错误

有时我在尝试从UITableView中删除一行时遇到此错误:Assertionfailurein-[UITableView_endCellAnimationsWithContext:]其他时候它会毫无问题地删除行。这是我的代码:-(void)tableView:(UITableView*)tableViewcommitEditingStyle:(UITableViewCellEditingStyle)editingStyleforRowAtIndexPath:(NSIndexPath*)indexPath{if(editingStyle==UITableViewCellEditingS

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

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

objective-c - iOS - EXC_BAD_ACCESS 错误

我正在开发iPhone/iPod应用程序。以下代码是UIViewController的.m文件。我得到以下信息:Thread1:EXC_BAD_ACCESS(code=2......当我点击以下行时:cell.textLabel.text=[datasourceobjectAtIndex:indexPath.row];我知道这通常发生在您在释放对象后尝试访问它时,但我不会在尝试访问它之前释放它。我在下面附上了完整的代码。感谢任何帮助!#import"HomePage.h"#import"HusbandryRecordsMain.h"#import"TaskManagerMain.h"#

iphone - 如何在 tableview (iPhone) 的特定部分清除(分隔符颜色)?

目前我在iPhone应用程序中工作,使用tableview开发表格及其样式,如分组,部分编号如2,然后第1部分的分隔符颜色如lightgray颜色,第2部分的分隔符颜色如clearColor。但是当我滚动表格View时,有时第二部分在第一部分处于事件状态时也会清除分隔符颜色,如何解决这个问题?请任何人帮助我提前致谢-(UITableViewCell*)tableView:(UITableView*)tableViewcellForRowAtIndexPath:(NSIndexPath*)indexPath{staticNSString*CellIdentifier=@"Cell";UI

iphone - 在不同的数组中添加不同部分的选定单元格,UICollectionView

我想在数组中添加UICollectionView的选定单元格,在不同的数组中逐节,意味着每个部分的数组不同。问题是部分的数量是动态的。下面是我的代码。-(void)collectionView:(UICollectionView*)collectionViewdidSelectItemAtIndexPath:(NSIndexPath*)indexPath{NSString*seatV;intcs;NSString*secVal=[arrSeatSelobjectAtIndex:indexPath.section];NSArray*arrSplit=[secValcomponentsSe

ios - 比较行数和 indexpath.row

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