CollectionView下拉刷新(第三方)-創(chuàng)新互聯(lián)

使用第三方 :MJRefresh

創(chuàng)新互聯(lián)技術(shù)團(tuán)隊(duì)10年來(lái)致力于為客戶提供網(wǎng)站設(shè)計(jì)制作、成都做網(wǎng)站、品牌網(wǎng)站制作、全網(wǎng)營(yíng)銷推廣、搜索引擎SEO優(yōu)化等服務(wù)。經(jīng)過(guò)多年發(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īng)顟B(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元起步,三天無(wú)理由+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)景需求。

網(wǎng)站題目:CollectionView下拉刷新(第三方)-創(chuàng)新互聯(lián)
標(biāo)題鏈接:http://bm7419.com/article6/gdcig.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供動(dòng)態(tài)網(wǎng)站、品牌網(wǎng)站設(shè)計(jì)網(wǎng)頁(yè)設(shè)計(jì)公司、企業(yè)建站品牌網(wǎng)站建設(shè)、關(guān)鍵詞優(yōu)化

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

成都seo排名網(wǎng)站優(yōu)化