i have a collection view controller if i add it as sub view as
YDCollectionViewCtr *collectionView = [self.storyboard instantiateViewControllerWithIdentifier:@"collectionview"];//collectionview
collectionView.view.frame = CGRectMake(0, 154, 320, 300);
collectionView.bussnessdic =bussinessphotoDic;
[self.navigationController.view addSubview:collectionView.view];
or [self.view addSubview:collectionView.view];
than just a black screen is added
but when i push it it works perfectly..... I need to add it as subview. Any kind of help will be appreciable
[self addChildViewController: collectionView];
Try this
Just replace
[self.navigationController.view addSubview:collectionView.view];
to
[self.view addSubview:collectionView.view];
我认为您应该将collectionView
添加为childViewController
I Faced this issue while working on my App.
you are not calling these methods.
[self.CollectionView.collectionViewLayout collectionViewContentSize];
[self.CollectionView reloadData];
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.