使用第三方 :MJRefresh
創(chuàng)新互聯(lián)技術(shù)團(tuán)隊(duì)10年來致力于為客戶提供網(wǎng)站設(shè)計(jì)制作、成都做網(wǎng)站、品牌網(wǎng)站制作、全網(wǎng)營(yíng)銷推廣、搜索引擎SEO優(yōu)化等服務(wù)。經(jīng)過多年發(fā)展,公司擁有經(jīng)驗(yàn)豐富的技術(shù)團(tuán)隊(duì),先后服務(wù)、推廣了數(shù)千家網(wǎng)站,包括各類中小企業(yè)、企事單位、高校等機(jī)構(gòu)單位。NSString *const MJCollectionViewCellIdentifier = @"Cell"; - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; // Override point for customization after application launch. self.window.backgroundColor = [UIColor whiteColor]; 創(chuàng)建collectionView UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; layout.itemSize = CGSizeMake(80, 80); layout.sectionInset = UIEdgeInsetsMake(20, 20, 20, 20); layout.minimumInteritemSpacing = 20; layout.minimumLineSpacing = 20; self.Colletion = [[ColletionView alloc]initWithFrame:[[UIScreen mainScreen] bounds] collectionViewLayout:layout]; self.Colletion.alwaysBounceVertical = YES; self.Colletion.backgroundColor = [UIColor purpleColor]; self.Colletion.dataSource = self; [self.Colletion registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:MJCollectionViewCellIdentifier]; [self addHeader]; [self.window addSubview:self.Colletion]; [self.Colletion release]; [self.window makeKeyAndVisible]; return YES; } - (void)addHeader { __unsafe_unretained typeof(self) vc = self; // 添加下拉刷新頭部控件 [self.Colletion addHeaderWithCallback:^{ // 進(jìn)入刷新狀態(tài)就會(huì)回調(diào)這個(gè)Block // 增加5條假數(shù)據(jù) // for (int i = 0; i<5; i++) { // [vc.fakeColors insertObject:MJRandomColor atIndex:0]; // } // 模擬延遲加載數(shù)據(jù),因此2秒后才調(diào)用) dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ [vc.Colletion reloadData]; // 結(jié)束刷新 [vc.Colletion headerEndRefreshing]; }); }]; } #pragma mark - collection數(shù)據(jù)源代理 - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { return 5; } - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:MJCollectionViewCellIdentifier forIndexPath:indexPath]; cell.backgroundColor = [UIColor redColor]; return cell; }附件:http://down.51cto.com/data/2364897
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。