collectionView
来源:互联网 发布:麦卡锡主义知乎 编辑:程序博客网 时间:2024/05/16 10:43
pscollection:
_collectionView = [[PSCollectionView alloc] initWithFrame:CGRectMake(0, 0, 320, WinSize.height-64-49)]; self.collectionView.backgroundColor = BGCOLOR;//[UIColor colorWithPatternImage:[UIImage imageNamed:@"seller_bg"]]; self.collectionView.collectionViewDelegate = self; self.collectionView.collectionViewDataSource = self; self.collectionView.delegate = self; self.collectionView.numColsPortrait = 2; // 显示几列 self.collectionView.numColsLandscape = 2; [self loadFooterView]; [self.view addSubview:self.collectionView]; [self.collectionView reloadData];
pullPsCollection:
self.collectionView = [[PullPsCollectionView alloc] initWithFrame:CGRectMake(0, 0, 320, self.view.bounds.size.height)]; NSLog(@"winsize.height = %f",Winsize.height); self.collectionView.collectionViewDelegate = self; self.collectionView.collectionViewDataSource = self; self.collectionView.pullDelegate=self; self.collectionView.delegate = self; self.collectionView.backgroundColor = [UIColor whiteColor]; //网格背景色 self.collectionView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; self.collectionView.numColsPortrait = 2; // 显示几列 self.collectionView.numColsLandscape = 2; //未知 //箭头 self.collectionView.pullArrowImage = [UIImage imageNamed:@"arrow"]; //下拉区域背景色 self.collectionView.pullBackgroundColor = [UIColor whiteColor]; //下拉显示文字 self.collectionView.pullTextColor = [UIColor brownColor]; //loadingView UILabel *vv = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 100)]; vv.center = CGPointMake(self.view.center.x, self.view.center.y-80); vv.layer.masksToBounds = YES; vv.text = @"Loading..."; vv.textAlignment = UITextAlignmentCenter; vv.textColor = [UIColor whiteColor]; vv.layer.cornerRadius = 5.f; vv.backgroundColor = [UIColor blackColor]; vv.alpha = 0.6; <pre name="code" class="objc"> self.collectionView.loadingView = vv;
if(!self.collectionView.pullTableIsRefreshing) { self.collectionView.pullTableIsRefreshing = YES; [self performSelector:@selector(refreshTable) withObject:nil afterDelay:1]; } [self.view addSubview:self.collectionView]; [self loadScrollerView];
#pragma -mark PSCollectionViewDelegate && PSCollectionViewDataSource- (void) refreshTable{ [self.imageArray removeAllObjects]; [self loadDataTest]; self.collectionView.pullLastRefreshDate = [NSDate date]; self.collectionView.pullTableIsRefreshing = NO; [self.collectionView reloadData];}- (void) loadMoreDataToTable{ [self.imageArray addObjectsFromArray:self.imageArray]; [self.collectionView reloadData]; self.collectionView.pullTableIsLoadingMore = NO;}#pragma mark - PullTableViewDelegate- (void)pullPsCollectionViewDidTriggerRefresh:(PullPsCollectionView *)pullTableView{ [self performSelector:@selector(refreshTable) withObject:nil afterDelay:1.0f];}- (void)pullPsCollectionViewDidTriggerLoadMore:(PullPsCollectionView *)pullTableView{ [self performSelector:@selector(loadMoreDataToTable) withObject:nil afterDelay:1.0f];}- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{ return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);}- (PSCollectionViewCell *)collectionView:(PSCollectionView *)collectionView viewAtIndex:(NSInteger)index { CellView *cell = (CellView *)[self.collectionView dequeueReusableView]; if (cell == nil) { cell = [[CellView alloc] init]; cell.backgroundColor = [UIColor lightGrayColor];//[self.colors objectAtIndex:n]; cell.layer.masksToBounds = YES; cell.layer.cornerRadius = 5.f; } return cell;}- (CGFloat)heightForViewAtIndex:(NSInteger)index { NSLog(@"self.collectionView.colWidth = %f",self.collectionView.colWidth);// [PSCollectionViewCell heightForViewWithObject:item inColumnWidth:self.collectionView.colWidth] int n = arc4random()%100 + 150; return n;}- (void)collectionView:(PSCollectionView *)collectionView didSelectView:(PSCollectionViewCell *)view atIndex:(NSInteger)index { // Do something with the tap NSLog(@"index = %i",index); HomeDetailViewController *controller = [[HomeDetailViewController alloc] initWithNibName:nil bundle:nil];// [ABTabBarViewController hideTabBarLevel:YES]; self.hidesBottomBarWhenPushed = YES; [self.navigationController pushViewController:controller animated:YES]; self.hidesBottomBarWhenPushed = NO;}- (NSInteger)numberOfViewsInCollectionView:(PSCollectionView *)collectionView { return self.imageArray.count;}
0 0
- CollectionView
- collectionView
- collectionView
- collectionView
- CollectionView
- CollectionView
- collectionView
- collectionView
- CollectionView
- collectionView
- collectionview
- Customised collectionView
- collectionView学习
- iOS CollectionView
- iOS---collectionView
- collectionView 小结
- ios collectionView
- CollectionView视图
- Fragment生命周期
- 每日记录
- Linux makefile 教程 非常详细,且易懂
- Hadoop学习笔记(二)——map reduce Helloworld
- 电阻的基础知识
- collectionView
- Hive 数据倾斜总结
- 10款实用Android UI工具
- poj 3071
- 我还能坚持多久?
- VS2010 单文档+多视图+Outlook风格
- 获取程序的当前路径
- 简单socket编程,传输文件,JAVA
- 过去的我们,现在的我!