//// Channelviewcontroller. M // mymangotv /// created by Apple on 14-8-19. // copyright (c) 2014 Camp David education. all rights reserved. // # import "channelviewcontroller. H "# import" commontableviewcell. H "# import" categoryview. H "@ interface channelviewcontroller () <uitableviewdatasource, uitableviewdelegate> {uitableview * _ tableview; nsarray * _ titlearray; nsarray * _ imagearray;} @ end @ implementation channelviewcontroll Er-(instancetype) initwithnibname :( nsstring *) nibnameornil bundle :( nsbundle *) handle {self = [Super initwithnibname: nibnameornil Bundle: nibbundleornil]; If (Self) {// initim initialization} return self;}-(void) viewdidload {[Super viewdidload]; self. view. backgroundcolor = [uicolor cyancolor]; _ tableview = [[uitableview alloc] initwithframe: Self. view. bounds style: uitableviewstyleplain]; _ Tab Leview. delegate = self; _ tableview. datasource = self; _ tableview. separatorstyle = uitableviewcellseparatorstylenone; [_ tableview registerclass: [commontableviewcell class] forcellreuseidentifier: @ "cell"]; [self. view addsubview: _ tableview]; _ titlearray = @ [@ "", @ "news", @ "TV series", @ "movie", @ "Music ", @ "cartoon", @ "Courier", @ "aimango", @ "VIP area", @ "Flowers and teenagers"]; _ imagearray [email protected] [@ "tvprogramicon", @ "newsicon", @ "parttabbarm VICON ", @" moviesicon ", @" musicsicon ", @" cartoonicon ", @" travelicon ", @" imgoappsicon ", @" vipicon ", @" huaeryushaonianicon "];} -(void) didreceivememorywarning {[Super didreceivemorywarning]; // dispose of any resources that can be recreated .} -(nsinteger) tableview :( uitableview *) tableview numberofrowsinsection :( nsinteger) Section {If (_ titlearray. count % 3) {return _ titlearray. count/3 + 1;} else {return _ Ti Tlearray. count/3 ;}- (cgfloat) tableview :( uitableview *) tableview heightforrowatindexpath :( nsindexpath *) indexpath {return 80;}-(uitableviewcell *) tableview :( uitableview *) tableview cellforrowatindexpath :( nsindexpath *) indexpath {static nsstring * identifier = @ "cell"; commontableviewcell * cell = [tableview metadata: identifier forindexpath: indexpath]; nsinteger ROW = [self table View: Nil numberofrowsinsection: 0]; nsinteger COUNT = (indexpath. Row + 1 = row )? (_ Titlearray. count % 3): 3; cell. numberofviewincell = ^ (commontableviewcell * sender) {return count ;}; cell. widthforcell = ^ cgfloat (commontableviewcell * sender, nsinteger index) {return 100 ;}; cell. viewforcell = ^ uiview * (commontableviewcell * sender, nsinteger index) {categoryview * V = [[categoryview alloc] initwithframe: cgrectmake (0, 0,100,100)]; V. imageview. image = [uiimage imagenamed: _ imagearray [indexpath. row * 3 + Index]; V. label. TEXT = _ titlearray [indexpath. row * 3 + Index]; If (indexpath. row * 3 + Index = 8) {v. vipimageview. image = [uiimage imagenamed: @ "vipcornericon.png"] ;}return v ;}; cell. didselectedview = ^ (commontableviewcell * cell, nsinteger index) {nslog (@ "% @", _ titlearray [indexpath. row * 3 + Index]) ;}; return cell ;}/ * # pragma mark-Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation-(void) prepareforsegue :( uistoryboardsegue *) segue sender :( ID) sender {// get the New View Controller Using [segue destinationviewcontroller]. // pass the selected object to the New View Controller .} * // @ end
Image list display