- Registriert
- 05.08.11
- Beiträge
- 94
Hallo Zusammen
Ich bin seit mehreren Stunden dran und kann den Fehler einfach nicht finden.
Momentan bin ich daran mit Xcode programmieren zu lernen.
Ich wollte mir einen TableView bauen in dem dann Menüpunkte angezeigt werden,
wo man klicken kann um zu den genaueren Infos zu kommen. Leider werden aber schon meine
Menüpunkte nicht angezeigt. Ich denke das ich einen Anfängerfehler mache.
Hier ist meine MenuStadionViewController.m:
Eigentlich sollte nun in meinem View die Einträge DCA 1 - 8 erscheinen. Aber leider passiert da nichts.
Wenn ich jetzt einen Testlauf mache sind zwar die Zeilen da, aber leider ohne Inhalt.
Wo könnte das Problem liegen? Es ist sicher ein Fehler der immer wieder gemacht wird.
Danke vielmals für eure Hilfe.
Freundliche Grüsse
DanHard
Ich bin seit mehreren Stunden dran und kann den Fehler einfach nicht finden.
Momentan bin ich daran mit Xcode programmieren zu lernen.
Ich wollte mir einen TableView bauen in dem dann Menüpunkte angezeigt werden,
wo man klicken kann um zu den genaueren Infos zu kommen. Leider werden aber schon meine
Menüpunkte nicht angezeigt. Ich denke das ich einen Anfängerfehler mache.
Hier ist meine MenuStadionViewController.m:
Code:
[COLOR=#008600]//[/COLOR]
[COLOR=#008600]// MenuStadionViewController.m[/COLOR]
[COLOR=#008600]// Hockeygod[/COLOR]
[COLOR=#008600]//[/COLOR]
[COLOR=#008600]// Created by Damian Hartmann on 10.09.11.[/COLOR]
[COLOR=#008600]// Copyright 2011 __MyCompanyName__. All rights reserved.[/COLOR]
[COLOR=#008600]//[/COLOR]
[COLOR=#ca2922][COLOR=#75492c]#import [/COLOR]"MenuStadionViewController.h"[/COLOR]
[COLOR=#b717a2]@implementation[/COLOR] MenuStadionViewController
- ([COLOR=#b717a2]id[/COLOR])initWithStyle:([COLOR=#7333a9]UITableViewStyle[/COLOR])style
{
[COLOR=#b717a2]self[/COLOR] = [[COLOR=#b717a2]super[/COLOR] [COLOR=#420f81]initWithStyle[/COLOR]:style];
[COLOR=#b717a2]if[/COLOR] ([COLOR=#b717a2]self[/COLOR]) {
[COLOR=#008600][COLOR=#000000] [/COLOR]// Custom initialization[/COLOR]
}
[COLOR=#b717a2][COLOR=#000000] [/COLOR]return[COLOR=#000000] [/COLOR]self[COLOR=#000000];[/COLOR][/COLOR]
}
- ([COLOR=#b717a2]void[/COLOR])dealloc
{
[[COLOR=#b717a2]super[/COLOR] [COLOR=#420f81]dealloc[/COLOR]];
}
- ([COLOR=#b717a2]void[/COLOR])didReceiveMemoryWarning
{
[COLOR=#008600][COLOR=#000000] [/COLOR]// Releases the view if it doesn't have a superview.[/COLOR]
[COLOR=#420f81][COLOR=#000000] [[/COLOR][COLOR=#b717a2]super[/COLOR][COLOR=#000000] [/COLOR]didReceiveMemoryWarning[COLOR=#000000]];[/COLOR][/COLOR]
[COLOR=#008600][COLOR=#000000] [/COLOR]// Release any cached data, images, etc that aren't in use.[/COLOR]
}
[COLOR=#75492c]#pragma mark - View lifecycle[/COLOR]
- ([COLOR=#b717a2]void[/COLOR])viewDidLoad
{
[COLOR=#420f81][COLOR=#000000] [[/COLOR][COLOR=#b717a2]super[/COLOR][COLOR=#000000] [/COLOR]viewDidLoad[COLOR=#000000]];[/COLOR][/COLOR]
[COLOR=#008600][COLOR=#000000] [/COLOR]// Uncomment the following line to preserve selection between presentations.[/COLOR]
[COLOR=#008600][COLOR=#000000] [/COLOR]// self.clearsSelectionOnViewWillAppear = NO;[/COLOR]
[COLOR=#008600][COLOR=#000000] [/COLOR]// Uncomment the following line to display an Edit button in the navigation bar for this view controller.[/COLOR]
[COLOR=#008600][COLOR=#000000] [/COLOR]// self.navigationItem.rightBarButtonItem = self.editButtonItem;[/COLOR]
}
- ([COLOR=#b717a2]void[/COLOR])viewDidUnload
{
[COLOR=#420f81][COLOR=#000000] [[/COLOR][COLOR=#b717a2]super[/COLOR][COLOR=#000000] [/COLOR]viewDidUnload[COLOR=#000000]];[/COLOR][/COLOR]
[COLOR=#008600][COLOR=#000000] [/COLOR]// Release any retained subviews of the main view.[/COLOR]
[COLOR=#008600][COLOR=#000000] [/COLOR]// e.g. self.myOutlet = nil;[/COLOR]
}
- ([COLOR=#b717a2]void[/COLOR])viewWillAppear:([COLOR=#b717a2]BOOL[/COLOR])animated
{
[[COLOR=#b717a2]super[/COLOR] [COLOR=#420f81]viewWillAppear[/COLOR]:animated];
}
- ([COLOR=#b717a2]void[/COLOR])viewDidAppear:([COLOR=#b717a2]BOOL[/COLOR])animated
{
[[COLOR=#b717a2]super[/COLOR] [COLOR=#420f81]viewDidAppear[/COLOR]:animated];
}
- ([COLOR=#b717a2]void[/COLOR])viewWillDisappear:([COLOR=#b717a2]BOOL[/COLOR])animated
{
[[COLOR=#b717a2]super[/COLOR] [COLOR=#420f81]viewWillDisappear[/COLOR]:animated];
}
- ([COLOR=#b717a2]void[/COLOR])viewDidDisappear:([COLOR=#b717a2]BOOL[/COLOR])animated
{
[[COLOR=#b717a2]super[/COLOR] [COLOR=#420f81]viewDidDisappear[/COLOR]:animated];
}
- ([COLOR=#b717a2]BOOL[/COLOR])shouldAutorotateToInterfaceOrientation:([COLOR=#7333a9]UIInterfaceOrientation[/COLOR])interfaceOrientation
{
[COLOR=#008600][COLOR=#000000] [/COLOR]// Return YES for supported orientations[/COLOR]
[COLOR=#b717a2]return[/COLOR] (interfaceOrientation == [COLOR=#420f81]UIInterfaceOrientationPortrait[/COLOR]);
}
[COLOR=#75492c]#pragma mark - Table view data source[/COLOR]
- ([COLOR=#7333a9]NSInteger[/COLOR])numberOfSectionsInTableView:([COLOR=#7333a9]UITableView[/COLOR] *)tableView
{
[COLOR=#75492c]#warning Potentially incomplete method implementation.[/COLOR]
[COLOR=#008600][COLOR=#000000] [/COLOR]// Return the number of sections.[/COLOR]
[COLOR=#b717a2]return[/COLOR] [COLOR=#4200d7]0[/COLOR];
}
- ([COLOR=#7333a9]NSInteger[/COLOR])tableView:([COLOR=#7333a9]UITableView[/COLOR] *)tableView numberOfRowsInSection:([COLOR=#7333a9]NSInteger[/COLOR])section
{
[COLOR=#b717a2]return[/COLOR] [COLOR=#4200d7]8[/COLOR];
}
- ([COLOR=#7333a9]UITableViewCell[/COLOR] *)tableView:([COLOR=#7333a9]UITableView[/COLOR] *)tableView cellForRowAtIndexPath:([COLOR=#7333a9]NSIndexPath[/COLOR] *)indexPath
{
[COLOR=#b717a2]static[/COLOR] [COLOR=#7333a9]NSString[/COLOR] *CellIdentifier = [COLOR=#ca2922]@"Cell"[/COLOR];
[COLOR=#7333a9]UITableViewCell[/COLOR] *cell = [tableView [COLOR=#420f81]dequeueReusableCellWithIdentifier[/COLOR]:CellIdentifier];
[COLOR=#b717a2]if[/COLOR] (cell == [COLOR=#b717a2]nil[/COLOR]) {
[COLOR=#420f81][COLOR=#000000] cell = [[[[/COLOR][COLOR=#7333a9]UITableViewCell[/COLOR][COLOR=#000000] [/COLOR]alloc[COLOR=#000000]] [/COLOR]initWithStyle[COLOR=#000000]:[/COLOR]UITableViewCellStyleDefault[COLOR=#000000] [/COLOR]reuseIdentifier[COLOR=#000000]:CellIdentifier] [/COLOR]autorelease[COLOR=#000000]];[/COLOR][/COLOR]
}
[COLOR=#008600][COLOR=#000000] [/COLOR]// Configure the cell...[/COLOR]
[COLOR=#420f81][COLOR=#000000] cell.[/COLOR][COLOR=#7333a9]accessoryType[/COLOR][COLOR=#000000] = [/COLOR]UITableViewCellAccessoryDisclosureIndicator[COLOR=#000000];[/COLOR][/COLOR]
[COLOR=#b717a2]switch[/COLOR] (indexPath.[COLOR=#7333a9]row[/COLOR]) {
[COLOR=#b717a2]case[/COLOR] [COLOR=#4200d7]0[/COLOR]: {
cell.[COLOR=#7333a9]textLabel[/COLOR].[COLOR=#7333a9]text[/COLOR] = [COLOR=#ca2922]@"DCA1"[/COLOR];
} [COLOR=#b717a2]break[/COLOR];
[COLOR=#b717a2]case[/COLOR] [COLOR=#4200d7]1[/COLOR]: {
cell.[COLOR=#7333a9]textLabel[/COLOR].[COLOR=#7333a9]text[/COLOR] = [COLOR=#ca2922]@"DCA2"[/COLOR];
} [COLOR=#b717a2]break[/COLOR];
[COLOR=#b717a2]case[/COLOR] [COLOR=#4200d7]2[/COLOR]: {
cell.[COLOR=#7333a9]textLabel[/COLOR].[COLOR=#7333a9]text[/COLOR] = [COLOR=#ca2922]@"DCA3"[/COLOR];
} [COLOR=#b717a2]break[/COLOR];
[COLOR=#b717a2]case[/COLOR] [COLOR=#4200d7]3[/COLOR]: {
cell.[COLOR=#7333a9]textLabel[/COLOR].[COLOR=#7333a9]text[/COLOR] = [COLOR=#ca2922]@"DCA4"[/COLOR];
} [COLOR=#b717a2]break[/COLOR];
[COLOR=#b717a2]case[/COLOR] [COLOR=#4200d7]4[/COLOR]: {
cell.[COLOR=#7333a9]textLabel[/COLOR].[COLOR=#7333a9]text[/COLOR] = [COLOR=#ca2922]@"DCA5"[/COLOR];
} [COLOR=#b717a2]break[/COLOR];
[COLOR=#b717a2]case[/COLOR] [COLOR=#4200d7]5[/COLOR]: {
cell.[COLOR=#7333a9]textLabel[/COLOR].[COLOR=#7333a9]text[/COLOR] = [COLOR=#ca2922]@"DCA6"[/COLOR];
} [COLOR=#b717a2]break[/COLOR];
[COLOR=#b717a2]case[/COLOR] [COLOR=#4200d7]6[/COLOR]: {
cell.[COLOR=#7333a9]textLabel[/COLOR].[COLOR=#7333a9]text[/COLOR] = [COLOR=#ca2922]@"DCA7"[/COLOR];
} [COLOR=#b717a2]break[/COLOR];
[COLOR=#b717a2]case[/COLOR] [COLOR=#4200d7]7[/COLOR]: {
cell.[COLOR=#7333a9]textLabel[/COLOR].[COLOR=#7333a9]text[/COLOR] = [COLOR=#ca2922]@"DCA8"[/COLOR];
} [COLOR=#b717a2]break[/COLOR];
}
[COLOR=#b717a2]return[/COLOR] cell;
}
[COLOR=#008600]/*[/COLOR]
[COLOR=#008600]// Override to support conditional editing of the table view.[/COLOR]
[COLOR=#008600]- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath[/COLOR]
[COLOR=#008600]{[/COLOR]
[COLOR=#008600] // Return NO if you do not want the specified item to be editable.[/COLOR]
[COLOR=#008600] return YES;[/COLOR]
[COLOR=#008600]}[/COLOR]
[COLOR=#008600]*/[/COLOR]
[COLOR=#008600]/*[/COLOR]
[COLOR=#008600]// Override to support editing the table view.[/COLOR]
[COLOR=#008600]- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath[/COLOR]
[COLOR=#008600]{[/COLOR]
[COLOR=#008600] if (editingStyle == UITableViewCellEditingStyleDelete) {[/COLOR]
[COLOR=#008600] // Delete the row from the data source[/COLOR]
[COLOR=#008600] [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];[/COLOR]
[COLOR=#008600] } [/COLOR]
[COLOR=#008600] else if (editingStyle == UITableViewCellEditingStyleInsert) {[/COLOR]
[COLOR=#008600] // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view[/COLOR]
[COLOR=#008600] } [/COLOR]
[COLOR=#008600]}[/COLOR]
[COLOR=#008600]*/[/COLOR]
[COLOR=#008600]/*[/COLOR]
[COLOR=#008600]// Override to support rearranging the table view.[/COLOR]
[COLOR=#008600]- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath[/COLOR]
[COLOR=#008600]{[/COLOR]
[COLOR=#008600]}[/COLOR]
[COLOR=#008600]*/[/COLOR]
[COLOR=#008600]/*[/COLOR]
[COLOR=#008600]// Override to support conditional rearranging of the table view.[/COLOR]
[COLOR=#008600]- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath[/COLOR]
[COLOR=#008600]{[/COLOR]
[COLOR=#008600] // Return NO if you do not want the item to be re-orderable.[/COLOR]
[COLOR=#008600] return YES;[/COLOR]
[COLOR=#008600]}[/COLOR]
[COLOR=#008600]*/[/COLOR]
[COLOR=#75492c]#pragma mark - Table view delegate[/COLOR]
- ([COLOR=#b717a2]void[/COLOR])tableView:([COLOR=#7333a9]UITableView[/COLOR] *)tableView didSelectRowAtIndexPath:([COLOR=#7333a9]NSIndexPath[/COLOR] *)indexPath
{
[COLOR=#008600][COLOR=#000000] [/COLOR]// Navigation logic may go here. Create and push another view controller.[/COLOR]
[COLOR=#008600]/*[/COLOR]
[COLOR=#008600] <#DetailViewController#> *detailViewController = [[<#DetailViewController#> alloc] initWithNibName:@"<#Nib name#>" bundle:nil];[/COLOR]
[COLOR=#008600] // ...[/COLOR]
[COLOR=#008600] // Pass the selected object to the new view controller.[/COLOR]
[COLOR=#008600] [self.navigationController pushViewController:detailViewController an[COLOR=#000000]imat[/COLOR][COLOR=#b717a2]ed:Y[/COLOR][COLOR=#000000]ES];[/COLOR][/COLOR]
[detailViewController release];
*/
}
@end
Eigentlich sollte nun in meinem View die Einträge DCA 1 - 8 erscheinen. Aber leider passiert da nichts.
Wenn ich jetzt einen Testlauf mache sind zwar die Zeilen da, aber leider ohne Inhalt.
Wo könnte das Problem liegen? Es ist sicher ein Fehler der immer wieder gemacht wird.
Danke vielmals für eure Hilfe.
Freundliche Grüsse
DanHard