As usual I encountered problem it is not well explained in internet and Apple documentation is limited.
I have UICollectionView with cells. I wanted to present movie poster inside each cell.I imported TVUIkit and addedd framework inside project settings.
My FilmCelkaCollectionViewCell.h contains
API_AVAILABLE(tvos(12.0))
@interface FilmCelkaCollectionViewCell : UICollectionViewCell
@property (strong, nonatomic) IBOutlet TVPosterView *widokPlakatu;
@end
FilmCelkaCollectionViewCell.m
does not contain any methods.
And in my collectionviewcontroller cell definition is as follow:
- (nonnull __kindof UICollectionViewCell *)collectionView:(nonnull UICollectionView *)collectionView cellForItemAtIndexPath:(nonnull NSIndexPath *)indexPath {
UICollectionViewCell *celka = (FilmCelkaCollectionViewCell*)[collectionView dequeueReusableCellWithReuseIdentifier:@"filmCela" forIndexPath:indexPath];
celka.backgroundColor =[UIColor greenColor];
return celka;
}
I added green background to see better area in simulator. But problem is I don't know how to access property TVPosterView *widokPlakatu
- the only thing I can access is celka.contentView
. I watched WWDC2018 video about "What's new in tvos12" and still have questions:
- Does TVPosterView acts like CollectionViewCell and I can use it with UICollectionView without cells?
- Is TVPosterView some special @property that cannot be accessed and must be initialized somewhere,somehow? I defined property in storyboard.
- Is it forbidden to put views inside the CollectionViewCell?
OK I found solution by accident.
This
will work while typecasting will not