標籤:div selectrow style 記錄 self pat news xpath oid
方法如下:
一般collectionView 或者 tableview都有內建的點擊函數,如下:1, collectionView -(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{//一般情況,cell不是自訂 UICollectionViewCell * cell = (UICollectionViewCell *)[collectionView cellForItemAtIndexPath:indexPath]; //即為要得到的cell//自訂的cell TitleViewCell * cell = (TitleViewCell *)[self collectionView:collectionView cellForItemAtIndexPath:indexPath];//即為要得到的cell}2,tableView-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{//非自訂cell UITableViewCell * cell = (UITableViewCell *)[tableView cellForRowAtIndexPath:indexPath]; //自訂cell NewsTableViewCell * cell = (NewsTableViewCell *)[self tableView:tableView cellForRowAtIndexPath:indexPath];}
僅做記錄!
ios開發之-- tableview/collectionview擷取當前點擊的cell