objective c - Setting up a UITableView within a UIViewController -



objective c - Setting up a UITableView within a UIViewController -

i know there hoards of questions out there topic, after looking through of them sense though nil working, bare me.

i have viewcontroller named quicklookview , need implement table view it. have declared tableview in header file:

@interface quicklookview : uiviewcontroller <uitableviewdelegate, uitableviewdatasource> ... @property (weak, nonatomic) iboutlet uitableview *medtableview; @end

in quicklookview.m synthesized medtableview , added standard uitableview methods:

#pragma mark - table view info source - (nsinteger)numberofsectionsintableview:(uitableview *)tableview { homecoming 1; } - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section { nsmutablearray * timeline = [gcore getdosagecontainer]; homecoming [timeline count]; } - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath* )indexpath { static nsstring *cellidentifier = @"medicinecell"; uitableviewcell *cell = [medtableview dequeuereusablecellwithidentifier:cellidentifier forindexpath:indexpath]; nsmutablearray * timeline = [gcore getdosagecontainer]; guardianpatientdosagetimeline * d; d = (guardianpatientdosagetimeline *) [timeline objectatindex: indexpath.row]; nsstring *medtimeline = [nsstring stringwithformat:@"%.02f %@ of %@",d->amount,d->units,d- >name]; if (cell == nil) { cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier]; } cell.textlabel.font = [uifont fontwithname:@"proximanova-regular" size:15]; cell.textlabel.text = medtimeline;//"todoitem.itemname; homecoming cell; }

this how delegate , datasource hooked up:

outlets

datasource------------------->quicklook view

delegate--------------------->quicklook view

referencing outlets

medtableview---------------->quicklook view

(i have posted picture, reputation not big enough...)

but still getting error after trying multitude of things. replacing return [timeline count]; normal integer linking things knows what. info in "timeline" , "gcore" used outside of file, know there info in there.

here error:

* terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[uiview tableview:numberofrowsinsection:]:

in attributes inspector table view, this:

objective-c uitableview uiviewcontroller delegates

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -