



下載本文檔
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
1、短視頻app源碼開發(fā):仿抖音短視頻熱門頁面的實(shí)現(xiàn)在短視頻app源碼開發(fā)中,仿抖音短視頻熱門頁面的實(shí)現(xiàn)只不過是多了一個(gè)由UICollectionView呈現(xiàn)多個(gè)視頻圖片的中間界面,點(diǎn)開后播放視頻界面其實(shí)就是推薦界面,所以這里并沒有什么核心難點(diǎn),只是簡單介紹下這個(gè)collectionView就好了。#importHotVideoVC.h#import#importRecommendVideoVC.h#importNearbyVideoModel.h#importVideoCollectionCell.h#importAFNetworking.hinterfaceHotVideoVC()proper
2、ty(nonatomic,strong)NSMutableArray*allArray;property(nonatomic,strong)NSArray*modelrray;property(nonatomic,strong)UICollectionView*collectionView;endimplementationHotVideoVCNSInteger_page;-(void)viewDidLoadsuperviewDidLoad;self.automaticallyAdjustsScrollViewInsets=NO;_modelrray=NSArrayarray;_page=1;
3、self.navigationCeractivePopGestureRecognizer.delegate=(id)self;self.automaticallyAdjustsScrollViewlnsets=NO;self.allArray=NSMutableArrayarray;UICollectionViewFlowLayout*flow=UICollectionViewFlowLayoutallocinit;flow.scrollDirection=UICollectionViewScrollDirectionVertical;flow.itemSize=CG
4、SizeMake(_window_width/2-1,(_window_width/2-1)*1.4);flow.minimumLineSpacing=2;flow.minimumlnteritemSpacing=2;self.collectionView=UICollectionViewallocinitWithFrame:CGRectMake(O,statusbarHeight,_window_width,_window_height-49-statusbarHeight-ShowDiff)cself.collectionViewregisterNib:UINibnibWithNibNam
5、e:VideoCollectionCellbundle:nilforCellWithReuseIdentifier:VideoCollectionCell;self.collectionView.delegate=self;self.collectionView.dataSource=self;self.collectionView.mj_footer=MJRefreshAutoNormalFooterfooterWithRefreshingBlock:A_page+;selfpullInternetforNew:_page;self.collectionView.mj_header=MJRe
6、freshNormalHeaderheaderWithRefreshingBlock:A_page=1;selfpullInternetforNew:_page;self.viewaddSubview:self.collectionView;self.view.backgroundColor=Black_Cor;self.collectionView.backgroundColor=UIColorblackColor;selfpullInternetforNew:1;因?yàn)榱斜聿豢梢悦看味贾匦滤⑿?,影響用戶體驗(yàn),也浪費(fèi)流量在視頻頁面輸出視頻后返回在視頻頁面輸出視頻后返回NSNotificatio
7、nCenterdefaultcenteraddObserver:selfselector:selector(getLiveList:)name:deleteobject:nil;發(fā)布視頻成功之后返回首頁刷新列表NSNotificationCenterdefaultCenteraddObserver:selfselector:selector(pullInternetforNewDown)name:reloadlistobject:nil;在視頻頁面刪除視頻回來后刪除-(void)getLiveList:(NSNotification*)nsnitofitionNSString*videoid=
8、NSStringstringWithFormat:%,nsnitofitionuserInfovalueForKey:videoid;NSDictionary*deletedic=NSDictionarydictionary;for(NSDictionary*subdicinself.allArray)NSString*videoids=NSStringstringWithFormat:%,subdicvalueForKey:id;if(videoidisEqual:videoids)deletedic=subdic;break;if(deletedic)self.allArrayremove
9、Object:deletedic;self.collectionViewreloadData;-(void)refreshNear/down-(void)pullInternetforNewDownself.allArray=NSMutableArrayarray;_page=1;selfpullInternetforNew:_page;-(void)getDataByFooterup_page+;selfpullInternetforNew:_page;-(void)pullInternetforNew:(NSInteger)pagesself.collectionView.userInte
10、ractionEnabled=NO;NSString*url=NSStringstringWithFormat:%&p=%ld,_url,(long)pages;WeakSelf;YBNetworkingpostWithUrl:urlDic:nilSuc:A(NSDictionary*data,NSString*code,NSString*msg)weakSelf.collectionView.mj_headerendRefreshing;weakSelf.collectionView.mjooterendRefreshing;weakSelf.collectionView.userInter
11、actionEnabled=YES;if(codeisEqual:0)NSArray*info=datavalueForKey:info;if(_page=1)self.allArrayremoveAllObjects;self.allArrayaddObjectsFromArray:info;加載成功停止刷新self.collectionView.mj_headerendRefreshing;self.collectionView.mj_footerendRefreshing;self.collectionViewreloadData;if(self.allArray.count0)Publ
12、icViewhiddenTextNoData:_collectionView;elsePublicViewshowTextNoData:_collectionViewtext1:text2:W無熱門視頻哦;if(info.count=0)self.collectionView.mj_footerendRefreshingWithNoMoreData;elseif(codeisEqual:700)PublicObjtokenExpired:minstr(datavalueForKey:msg);elseelseif(self.allArray)self.allArrayremoveAllObje
13、cts;self.collectionViewreloadData;PublicViewshowTextNoData:_collectionViewtext1:text2:W無熱門視頻哦”;Fail:Uidfail)weakSelf.collectionView.userInteractionEnabled=YES;self.collectionView.userInteractionEnabled=YES;if(self.allArray)self.allArrayremoveAllObjects;self.collectionViewreloadData;PublicViewshowTex
14、tNoData:_collectionViewtext1:text2:W無熱門視頻哦”;self.collectionView.mj_headerendRefreshing;self.collectionView.mj_footerendRefreshing;#pragmamark-Tableviewdatasource-(NSInteger)collectionView:(UICollectionView*)collectionViewnumberOfItemsInSection:(NSInteger)sectionreturnself.allArray.count;-(CGFloat)co
15、llectionView:(UICollectionView*)collectionViewlayout:(UICollectionViewLayout*)collectionViewLayoutminimumLineSpacingForSectionAtIndex:(Nreturn2;-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView*)collectionViewreturn1;-(void)collectionView:(UICollectionView*)collectionViewdidSelectItemAt
16、IndexPath:(NSIndexPath*)indexPathVideoCollectionCell*cell=(VideoCollectionCell*)collectionViewcellForItemAtIndexPath:indexPath;RecommendVideoVC*video=RecommendVideoVCallocinit;video.fromWhere=myVideoV;video.curentIndex=indexPath.row;video.videoList=_allArray;video.pages=_page;video.firstPlacelmage=c
17、ell.bglmageV.image;video.requestUrl=_url;video.block=A(NSMutableArray*array,NSIntegerpage,NSIntegerindex)_page=page;self.allArray=array;self.collectionViewreloadData;self.collectionViewscrollToItemAtIndexPath:NSIndexPathindexPathForItem:indexinSection:0atScrollPosition:UICollectionViewScrollPositionBottomanim;/video.hidesBottomBarWhenPushed=YES;TCBaseAppDelegatesharedAppDelegatepushViewController:videoanimated:YES;-(UICollectionViewCell*)collectionView:(UICollectionView*)collectionViewcellForItemAtIndexPath:(NSIndexPath*)indexPathVideoCollectionCell*cell=(Vide
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 明達(dá)職業(yè)技術(shù)學(xué)院《計(jì)量學(xué)與互換性基礎(chǔ)俄》2023-2024學(xué)年第二學(xué)期期末試卷
- 西南民族大學(xué)《供應(yīng)鏈系統(tǒng)仿真與優(yōu)化》2023-2024學(xué)年第二學(xué)期期末試卷
- 鄭州智能科技職業(yè)學(xué)院《建筑設(shè)計(jì)初步》2023-2024學(xué)年第二學(xué)期期末試卷
- 內(nèi)蒙古豐州職業(yè)學(xué)院《城市公共景觀設(shè)計(jì)》2023-2024學(xué)年第二學(xué)期期末試卷
- 上海交通大學(xué)《城市社會(huì)工作》2023-2024學(xué)年第二學(xué)期期末試卷
- 展館空間設(shè)計(jì)項(xiàng)目效益評(píng)估報(bào)告
- 山東財(cái)經(jīng)大學(xué)《分析化學(xué)實(shí)驗(yàn)2》2023-2024學(xué)年第二學(xué)期期末試卷
- 和君職業(yè)學(xué)院《護(hù)理禮儀》2023-2024學(xué)年第二學(xué)期期末試卷
- 濱州學(xué)院《GPS》2023-2024學(xué)年第二學(xué)期期末試卷
- 桂林信息科技學(xué)院《成癮醫(yī)學(xué)》2023-2024學(xué)年第二學(xué)期期末試卷
- 醫(yī)療機(jī)構(gòu)消毒記錄表清潔消毒日檢查記錄表
- 2024年北京大學(xué)強(qiáng)基計(jì)劃數(shù)學(xué)試卷試題真題(含答案詳解)
- 2024年巴西脈沖灌洗系統(tǒng)市場機(jī)會(huì)及渠道調(diào)研報(bào)告
- 高壓電工證考試題庫及答案(完整版)
- 精索靜脈曲張臨床路徑表單
- 2024年山東圣翰財(cái)貿(mào)職業(yè)學(xué)院單招綜合素質(zhì)考試題庫含答案(綜合卷)
- 委外催收機(jī)構(gòu)入圍項(xiàng)目投標(biāo)技術(shù)方案(技術(shù)標(biāo))
- (正式版)JBT 2930-2024 低壓電器產(chǎn)品型號(hào)編制方法
- 工程機(jī)械作業(yè)安全培訓(xùn)
- 塑料件外觀檢驗(yàn)規(guī)范
- 消費(fèi)者行為學(xué)教案-消費(fèi)群體與消費(fèi)者行為教案
評(píng)論
0/150
提交評(píng)論