私が持っています UICollectionView
そのセルは UITableView
その中。 どのように参照しますか UITableView
のカスタムクラスを作成せずにその中に UICollectionViewCell
のための参照用アウトレット付き UITableView
?
そのために新しいクラスを作成したくない理由 UICollectionViewCell
参照する以外の目的はないからです。 UITableView
.
このようなもの:
UICollectionViewCell *collectionViewCell = [collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath];
//Need to reference the UITableView (obviously this doesn"t work)
UITableView *tableView = collectionViewCell.tableView;
ありがとう!
回答:
回答№1は1しかし、セルにプロパティがある[cell.contentView viewWithTag:someValue]テーブルビューのタグを単にsomeValueに追加して設定し、後で参照することができます。
お役に立てれば。
回答№2の場合は0
サブビューをループすることができます
for(UIView *view in collectionViewCell.subviews)
{
if([view isKindOfClass:[UITableView class]])
{
UITableView *tableView = (UITableView *)view;
}
}