Basic use of iOS_21 group_uicollectionview, uiwebview in ios
Finally:
Code snippet:
DealListController inherits from UICollectionViewController
Self. view already contains a UICollectionView
And the data source and proxy are already the current controller self
//// DealListController. m // handsome _ buy /// Created by beyond on 14-8-14. // Copyright (c) 2014 com. beyond. all rights reserved. // click the Controller corresponding to the group purchase button on the dock. The navigation bar is displayed on the top, the searchBar is displayed on the right, and a large button (TopMenu) is displayed on the left of the navigation bar) (It consists of three buttons internally <TopMenuItem>) # import "DealListController. h "// There is a big button (top menu) # import" TopMenu on the left of the navigation bar. h "# define kItemW 250 # define kItemH 250 @ implementation DealListController // override the Controller's init method-(id) init {// create a stream layout UICollect IonViewFlowLayout * layout = [[UICollectionViewFlowLayout alloc] init]; // you can specify the width and height of each grid in the stream layout, that is, layout. itemSize = CGSizeMake: layout];}-(void) viewDidLoad {[super viewDidLoad]; // 1. basic settings in the top navigation bar [self setNavigationBar]; // 2. basic settings of collectionView [self s EtCollectionView];} // 2. basic settings in the top navigation bar-(void) setNavigationBar {// 1. UISearchBar * s = [[UISearchBar alloc] init]; s. frame = CGRectMake (0, 0,210, 35); s. placeholder = @ "Enter product name, address, etc."; self. navigationItem. rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView: s]; // 2. topMenu * top = [[TopMenu alloc] init]; // important: After you click the item in TopMenu, where will the created PopMenu be added ??? Is the view top of the controller. controllerView = self. view; self. navigationItem. leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView: top];} // 3. basic settings of collectionView-(void) setCollectionView {// 1. set the background color of the collectionView (unlike tableViewController, the view of this controller is UIView, And the collectionView added in the UIView) self. collectionView. backgroundColor = kGlobalBg; // 2. important ~~~ The xib [self. collectionView registerNib: [UINib nibWithNibName: @ "DealCell" bundle: nil] forCellWithReuseIdentifier: @ "DealCell"]; // 3. sets collectionView to always support vertical scrolling and prepares (spring) self for pull-down refresh. collectionView. alwaysBounceVertical = YES;} // 4. important ~~~ When the controller is created, the default width is 768 and the default height is 1024. no matter whether the screen is horizontal or vertical, the view can be obtained most accurately (that is, the actual view) only in the viewWillAppear and viewDidAppear methods) width and height (width and height)-(void) viewWillAppear :( BOOL) animated {// default calculation layout [self didRotateFromInterfaceOrientation: 0];} # pragma mark-parent class method // interval, called when the screen is about to rotate (Controller monitoring screen rotation)-(void) willRotateToInterfaceOrientation :( UIInterfaceOrientation) toInterfaceOrientation duration :( NSTimeInterval) duration {log (@ "the screen is about to rotate");} // intercept, call-(void) didRotateFromInterfaceOrientation (UIInterfaceOrientation) fromInterfaceOrientation {// 1. retrieve the UICollectionViewFlowLayout * layout = (UICollectionViewFlowLayout *) self. collectionView. collectionViewLayout; // 2. calculation interval CGFloat v = 0; CGFloat h = 0; CGFloat height = self. view. frame. size. height-44; CGFloat width = self. view. frame. size. width; if (UIInterfaceOrientationIsLandscape (self. interfaceOrientation) {// horizontal screen spacing v = (height-2 * kItemH)/3; h = (width-3 * kItemW)/4 ;} else {// vertical screen spacing v = (height-3 * kItemH)/4; h = (width-2 * kItemW)/3;} // 3. adjust the distance between the grids in the animation [UIView animateWithDuration: 4.0 animations: ^ {// margin layout in the upper left and lower right directions. sectionInset = UIEdgeInsetsMake (v, h, v, h); // layout. minimumLineSpacing = v ;}] ;}# pragma mark-collectionView proxy method // Total number of items (I .e., grid Cube)-(NSInteger) collectionView :( UICollectionView *) collectionView numberOfItemsInSection :( NSInteger) section {return 6;} // generate each unique grid-(UICollectionViewCell *) collectionView :( UICollectionView *) collectionView cellForItemAtIndexPath :( NSIndexPath *) indexPath {static NSString * cellID = @ "DealCell"; UICollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier: cellID forIndexPath: indexPath]; // set unique data return cell ;}
The grid in CollectionView is generally the same in appearance. You can use xib
DealCell. xib
Namespace in which silverlight PagedCollectionView is located
This seems to be in toolkit! Navigation by page! Download a toolkit from the official website! Where can I find a dome instance to help you use it ~~~!
Flex undefined exception at mxcollections: ListCollectionView/get length () [E: \ dev \ 4y \ frameworks \ proje
The array is null, but you use the array. lenth () method.