我的数组有问题,我试图从 MutableArray 加载我的 TableView 数据。但是我尝试失败了......我没有出错,但是如果我打开 TableView,则视图是空的。这是我的代码,也许你有什么想法。
- (void)viewDidLoad
{
[super viewDidLoad];
[self.tableView reloadData];
NSLog(@"Wert von tE nachdem die Seite geladen hat, ist wie folgt: %d", trickEins);
}
-(NSMutableArray *)mutableArrayAusTricksArray:(NSArray *)array {
NSLog(@"Wert: %d", trickEins);
self.tricksFavoriten = [NSMutableArray new];
if (trickEins == 2) {[self.tricksFavoriten addObject:@"Body Feint"];};
if (trickZwei == 2) {[self.tricksFavoriten addObject:@"Stepover"];};
if (trickDrei == 2) {[self.tricksFavoriten addObject:@"Reverse Stepover"];};
if (trickVier == 2) {[self.tricksFavoriten addObject:@"Ball Roll"];};
if (trickFuenf == 2) {[self.tricksFavoriten addObject:@"Drag Back"];};
[self.tableView reloadData];
return self.tricksFavoriten;
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
#warning Potentially incomplete method implementation.
// Return the number of sections.
return 0;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
// Return the number of rows in the section.
return [self.tricksFavoriten count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
cell.textLabel.text = self.tricksFavoriten[indexPath.row];
return cell;
}
@end