更新到iOS 10后,我的应用程序中的UICollectionViews停止工作。它们只是没有出现在视图控制器中。
UICollectionViewFlowLayout *dailyFlowLayout = [[UICollectionViewFlowLayout alloc] init];
[dailyFlowLayout setItemSize:CGSizeMake(200, 140)];
[dailyFlowLayout setScrollDirection:UICollectionViewScrollDirectionHorizontal];
dailyCollectionView = [[DailyWeatherCollectionView alloc] initWithFrame:CGRectMake(15, self.frame.size.height / 2 - 77, [UIScreen mainScreen].bounds.size.width - 30, 104) collectionViewLayout:dailyFlowLayout];
[dailyCollectionView registerNib:[UINib nibWithNibName:@"DailyWeatherCollectionViewCell" bundle:nil] forCellWithReuseIdentifier:@"DailyWeatherCollectionViewCell"];
[self.contentView addSubview:dailyCollectionView];
UICollectionViewFlowLayout *hourlyFlowLayout = [[UICollectionViewFlowLayout alloc] init];
[hourlyFlowLayout setItemSize:CGSizeMake(200, 140)];
[hourlyFlowLayout setScrollDirection:UICollectionViewScrollDirectionHorizontal];
hourlyCollectionView = [[HourlyWeatherCollectionView alloc] initWithFrame:CGRectMake(15, self.frame.size.height / 2 - 251, [UIScreen mainScreen].bounds.size.width - 30, 159) collectionViewLayout:hourlyFlowLayout];
[hourlyCollectionView registerNib:[UINib nibWithNibName:@"HourlyWeatherCollectionViewCell" bundle:nil] forCellWithReuseIdentifier:@"HourlyWeatherCollectionViewCell"];
[self.contentView addSubview:hourlyCollectionView];