i can't seem find method/line of code can use add cells table in xcode without storyboard (if that's possible). seems quick solution exists haven't found it. if know example of this, please point out.
#import "appdelegate.h" #import "subviewcontroller.h" #import "subtableviewcontroller.h" @implementation appdelegate - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { self.window = [[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]]; // override point customization after application launch. self.window.backgroundcolor = [uicolor whitecolor]; //subviewcontroller = tabbarcontroller uitabbarcontroller * tabbarcontroller = [[uitabbarcontroller alloc] init]; self.window = [[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]]; subviewcontroller * firsttab= [[subviewcontroller alloc] init ]; [firsttab.view setbackgroundcolor:[uicolor greencolor]]; firsttab.title = @"first"; uinavigationcontroller *navigationcontroller1 = [[uinavigationcontroller alloc] initwithrootviewcontroller:firsttab]; subviewcontroller *secondtab = [[subviewcontroller alloc] init]; [secondtab.view setbackgroundcolor:[uicolor redcolor]]; secondtab.title = @"second"; uinavigationcontroller *navigationcontroller2 = [[uinavigationcontroller alloc] initwithrootviewcontroller:secondtab]; subtableviewcontroller * table = [[subtableviewcontroller alloc] init]; uinavigationcontroller * nav3 = [[uinavigationcontroller alloc]initwithrootviewcontroller:table]; table.title = @"third"; tabbarcontroller.viewcontrollers = @[navigationcontroller1,navigationcontroller2, nav3]; [self.window setrootviewcontroller:tabbarcontroller]; [self.window makekeyandvisible]; return yes; }
if using tableviewcontroller template provided xcode there is
- (nsinteger)numberofsectionsintableview:(uitableview *)tableview - sections in tableview
- (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section number of rows in each section
- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath where can set text of each cell
i'ld rather suggest should check out basic tutorials appcode tutorial
Comments
Post a Comment