iphone - Table view is taking up the whole view instead of taking input width and height -


i want relatively small table view in app. seem have no luck because table view taking whole screen.

 -(void)viewdidload{  uitableview *tableview = [[uitableview alloc] initwithframe:cgrectmake(0.0, 0.0, 20.0, 60.0) style:uitableviewstyleplain];     self.view = tableview;  }     - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *mycellidentifier = @"mycellidentifier";  uitableviewcell *cell = [self.tableview dequeuereusablecellwithidentifier:mycellidentifier];  if(cell == nil) {     cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:mycellidentifier]; }  return cell;    }    - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section { return 5;   } 

in viewdidload method replace self.view = tableview

[self.view addsubview:tableview]; 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -