ios - TableView didn't show data -


i created 2 uitableviews make drawercontroller.

  1. the left uitableview isn't showing data correctly.
  2. the tableheaderview has separator in background.
  3. pagecontrol's x position moving half screen width in difference set it.

there project in github.

there mainview:

- (void)viewdidload {     [super viewdidload];     uitableview *maintableview=[maintableview createmainview];     self.maintableview=maintableview;     self.maintableview.frame=cgrectmake(0, 0, yscreenwidth, yscreenheight);     maintableview.delegate=self;     maintableview.datasource=self;     [self.view addsubview:maintableview];      uitableview *leftmenutableview=[leftmenutableview createleftmenuview];     self.leftmenutableview=leftmenutableview;     _leftmenutableview.backgroundcolor=[uicolor colorwithred:26/256.f green:31/256.f blue:36/256.f alpha:0.7];     leftmenutableview.delegate=self;     leftmenutableview.datasource=self;     [self.view addsubview:leftmenutableview];     self.navigationcontroller.navigationbar.barstyle=uistatusbarstylelightcontent;     uibutton *leftbar=[[uibutton alloc]initwithframe:cgrectmake(0, 20, 44, 44)];     nsstring *bundlestr=@"resource.bundle/";     nsstring *imagepath=[bundlestr stringbyappendingstring:@"lefticon.png"];     [leftbar setimage:[uiimage imagenamed:imagepath] forstate:uicontrolstatenormal];     [leftbar addtarget:self action:@selector(showleftmenu) forcontrolevents:uicontroleventtouchupinside];     [self.view insertsubview:leftbar abovesubview:maintableview]; } 

there datasource method:

#pragma mark - table view data source - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section {     if (tableview == _maintableview) {         return trytbdata.count;     }else if (tableview ==_leftmenutableview){         return 13;     }     return 0; } - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {     static nsstring *maincellid=@"main_cell";     static nsstring *leftcell=@"reuseidentifier";     uitableviewcell *cell=[[uitableviewcell alloc]init];     if (tableview == _maintableview) {         cell=[_maintableview dequeuereusablecellwithidentifier:maincellid];         if (!cell) {             cell=[[uitableviewcell alloc]initwithstyle:uitableviewcellstyledefault reuseidentifier:maincellid];         }         cell.textlabel.text=trytbdata[indexpath.row];     }else if (tableview == _leftmenutableview){         cell=[_leftmenutableview dequeuereusablecellwithidentifier:leftcell];         if (!cell) {             cell=[[uitableviewcell alloc]initwithstyle:uitableviewcellstyledefault reuseidentifier:leftcell];         }         cell.textlabel.text=@"22";     }     return cell; } 

maintableview show correct data, leftmenutableview isn't showing data. run picture

get rid of [self addmenutable]; in leftmenutableview.m.

you creating leftmenutableview object , adding table view on top of it.

if use debug view hierarchy feature in xcode, can see cells "22" in them behind view that's blocking them.


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -