मेरे पास एक टेबल व्यू कंट्रोलर है जिसे मैं किसी सरणी से ऑब्जेक्ट्स के साथ पॉप्युलेट करना चाहता हूं। मैं स्टोरीबोर्ड का उपयोग कर रहा हूं। साथ ही, मुझे यकीन नहीं है कि मुझे स्टोरीबोर्ड में सेल प्रोटोटाइप में लेबल्स को प्लेसहोल्डर के रूप में रखने की आवश्यकता है या नहीं?ऑब्जेक्ट्स के ऐरे के साथ टेबल व्यू कैसे पॉप्युलेट करें?
मेरा एलीस्ट म्यूटेबल ऐरे में होमवर्क के प्रकार शामिल हैं। तालिका की प्रत्येक पंक्ति में, मैं प्रदर्शित करने के लिए (ये हैं चर पहले से ही अपने घर का पाठ मॉडल में सेट) हैं:
-ClassName
-AssignmentTitle
-DueDate
यहाँ क्या है मैं वर्तमान में
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;
}
संभावित डुप्लिकेट [सरणी से UITableView पॉप्युलेटिंग] (http://stackoverflow.com/questions/4367393/populating-a-uitableview-from-arrays) –