Ho un controller TableView che desidero popolare con gli oggetti da un array. Sto usando StoryBoard. Inoltre, non sono sicuro di dover inserire etichette nel Prototipo cella nello storyboard come tipo di segnaposto?Come popolare un TableView con una matrice di oggetti?
My aList La matrice mobile contiene oggetti di tipo Homework. In ogni riga della tabella, voglio visualizzare (Queste variabili sono già impostati nel mio Homework Modello):
-ClassName
-AssignmentTitle
-DueDate
Ecco quello che ho attualmente hanno
TableViewController.h
@interface AssignmentTableController : UITableViewController
<
AssignmentDelegate
>
@property(strong,nonatomic) Assignment *vc;
@property (strong, nonatomic) NSMutableArray *alist;//array was filled with delegation
@end
TableViewController.m
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
// Return the number of sections.
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
// Return the number of rows in the section.
return [self.alist count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
Homework *ai = [self.alist objectAtIndex:indexPath.row];
//*******I am not sure what to do from Here******
//*******I need to start displaying 1 object per row,displaying what was stated above***
// Configure the cell...
return cell;
}
possibile duplicato di [Popolare un UITableView da array] (http://stackoverflow.com/questions/4367393/populating-a-uitableview-from-arrays) –