Monday, 15 February 2010

ios - Adding UICollectionViewLayout programmatically issue -


I'm trying to apply without using StoryBoard (the first step to implement this library) because I am creating my UIcollectionView program.

- (zero) viewDidoadload {[Super Viewedload]; // Setup an additional after loading the view //self.view.backgroundColor = [UIColor whiteColor]; [Self.view addSubview: self.collectionView]; [_collectionView registerNib: [UINib nibWithNibName: @ "myCell" bundle: zero] forCellWithReuseIdentifier: @ "cell3"]; [_collectionView setBackgroundColor: [UIColor colorWithRed: 0.945 green: 0.945 blue: 0.945 alpha: 1]]; [_collectionViewsettransforms: CGFine Transmacemaxel (-1, 1)]; RFQuiltLayout * Layout = (ID) [_ Collections archive viewView]; Layout.direction = UICollectionViewScrollDirectionVertical; Layout. BlockPixels = CGSizeMake (100, 100); } - See the (UICollectionView *) collection {if (! _collectionView) {CGRect Collection ViewFrame = self.view.bounds; Collection ViewFrame.size.height - = (self.navigationController.viewControllers.count> 1? 0: (CGRectGetHeight (self.tabBarController.tabBar.bounds))) + 0; // FMMosiacLayout * Mosaiclayout = [[FMMosiacElelectOlock] Init]; //// _collectionView = [[[UICollectionView alloc] initWithFrame: Collections ViewForm CollectionWuleout: Mosaiclayout]; // RFQuiltLayout * Layout = (ID) [_ Collections archive viewView]; // layout.direction = UICollectionViewScrollDirectionVertical; // layout.blockPixels = CGSizeMake (100, 100); _collectionView = [[UICollectionView alloc] initWithFrame: archive viewfile collectionview layout: [[RFqualletlayout shelf] init]]; _collectionView.delegate = self; _collectionView.dataSource = self; } Return _collectionView; }

but it was not working and in my opinion nothing is shown (error and empty view) Besides this, I have informed that using UbuntuViewView The method never calls

Second, if you want to add a custom layout without the XIB's storyboard, then you have to set it programmatically:

  rfcquat layout * layout = [[rfqwalt Layout light] init]; Layout.direction = UICollectionViewScrollDirectionVertical; Layout. BlockPixels = CGSizeMake (100, 100); Self.collectionView.collectionViewLayout = Layout;  

No comments:

Post a Comment