2014-06-13 239 views
-1

當我用SIGNAL1:SIGABRT點擊一個UITableViewCell時,我的應用程序崩潰。 這是我的錯誤代碼:應用程序崩潰,錯誤代碼

2014-06-13 18:25:28.232 MyClothezz[1266:239793] Unknown class KategorienTableViewDetailControllerViewController in Interface Builder file. 
2014-06-13 18:25:57.461 MyClothezz[1266:239793] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIViewController 0x125d524f0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key gewaehlteKategorie.' 
*** First throw call stack: 
(0x187375dc4 0x1968701e8 0x187375a48 0x18818e818 0x1872a473c 0x18bc11ac4 0x18bb26cbc 0x18b81492c 0x18b814898 0x18b9b4b8c 0x18b8c7ba8 0x18b8c7974 0x18b8c78f4 0x18b81190c 0x18b191b5c 0x18b18c758 0x18b18c5fc 0x18b18bdfc 0x18b18bb80 0x18b18570c 0x18732fd60 0x18732ccec 0x18732d0cc 0x187259444 0x18fccb7e4 0x18b8799c8 0x1000d5b18 0x196ee2a08) 
libc++abi.dylib: terminating with uncaught exception of type NSException 
(lldb) 

那麼這是什麼意思?我做錯了什麼?我需要改變什麼? 我會附上一切,但如果你需要更多的細節,請問! 非常感謝你!

這是我的RootViewController的.h文件中:

#import <UIKit/UIKit.h> 
#import <iAd/iAd.h> 


@interface KategorienTableViewController : UITableViewController <UISearchBarDelegate, UIAlertViewDelegate> 
@property (strong, nonatomic) IBOutlet UISearchBar *searchBar; 
@property (nonatomic, strong) NSMutableArray *category; 
@property (nonatomic, strong) NSMutableArray *results; 

@end 

這是我的RootViewController的.m文件:

#import "KategorienTableViewController.h" 
#import "KategorienDetailTableViewController.h" 
#import "KategorienInfoViewController.h" 

@interface KategorienTableViewController() 


@end 

@implementation KategorienTableViewController 
@synthesize category; 

-(NSMutableArray *)category 
{ 
if (!category) 

{ 
    category = [[NSMutableArray alloc]init]; 
} 
return category; 
} 

-(NSMutableArray *)results 
{ 
if (!_results) 
{ 
    _results = [[NSMutableArray alloc]init]; 
} 
return _results; 
} 

- (void)viewDidLoad 
{ 
[super viewDidLoad]; 
[self.category addObject:@"Accessories" ]; 
[self.category addObject:@"Blouses"]; 
[self.category addObject:@"Bras"]; 
[self.category addObject:@"Caps"]; 
[self.category addObject:@"Cardigans & Sweaters"]; 
[self.category addObject:@"Dresses"]; 
[self.category addObject:@"Hot-Pants"]; 
[self.category addObject:@"Jackets & Coats"]; 
[self.category addObject:@"Jackettes"]; 
[self.category addObject:@"Jeans & Pants"]; 
[self.category addObject:@"Leggins"]; 
[self.category addObject:@"Longsleeves"]; 
[self.category addObject:@"Shirts"]; 
[self.category addObject:@"Shoes"]; 
[self.category addObject:@"Shorts"]; 
[self.category addObject:@"Skirts"]; 
[self.category addObject:@"Suits"]; 
[self.category addObject:@"Swimwear"]; 
[self.category addObject:@"Tights"]; 
[self.category addObject:@"Tops"]; 
[self.category addObject:@"T-Shirts"]; 
[self.category addObject:@"Underwear"]; 

// Uncomment the following line to preserve selection between presentations. 
self.clearsSelectionOnViewWillAppear = NO; 

// Uncomment the following line to display an Edit button in the navigation bar for this view controller. 
self.navigationItem.leftBarButtonItem = self.editButtonItem; 


UIBarButtonItem *addButton =[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(insertNewObject)]; 
self.navigationItem.rightBarButtonItem = addButton; 



} 
- (void)didReceiveMemoryWarning 
{ 
[super didReceiveMemoryWarning]; 
// Dispose of any resources that can be recreated. 
} 

-(void)searchThroughData 
{ 
self.results = nil; 

NSPredicate *resultsPredicate = [NSPredicate predicateWithFormat:@"SELF contains [search] %@", self.searchBar.text]; 
self.results = [[self.category filteredArrayUsingPredicate:resultsPredicate] mutableCopy]; 
} 

-(void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText 
{ 
[self searchThroughData]; 
} 


- (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. 
if (tableView == self.tableView) 
{ 
    return self.category.count; 
} 
else 
{ 
    [self searchThroughData]; 
    return self.results.count; 
} 

} 
-(void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath 
{ 
// Push new View controller here 
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; 
KategorienTableViewController *viewController = (KategorienTableViewController *)[storyboard instantiateViewControllerWithIdentifier:@"Detail"]; 
[self.navigationController pushViewController:viewController animated:YES]; 

} 

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
static NSString *CellIdentifier = @"Cell"; 
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 



[cell setAccessoryType:UITableViewCellAccessoryDetailDisclosureButton]; 

if (!cell) 
{ 
    cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; 
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; 
} 

if (tableView == self.tableView) 
{ 
    cell.textLabel.text = self.category [indexPath.row]; 
} 
else 
{ 
    cell.textLabel.text = self.results [indexPath.row]; 
} 

// Configure the cell... 

    return cell; 

} 


// Override to support conditional editing of the table view. 
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath 

{ 
// Return NO if you do not want the specified item to be editable. 
return YES; 
[tableView reloadData]; 


} 




// Override to support editing the table view. 
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
if (editingStyle == UITableViewCellEditingStyleDelete) 
{ 
    // Delete the row from the data source 
    [self.category removeObjectAtIndex:indexPath.row]; 
    [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade]; 
    [tableView reloadData]; 
} 


else if (editingStyle == UITableViewCellEditingStyleInsert) 
{ 
    // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view 
    [tableView reloadData]; 

} 

} 

- (void)insertNewObject 
{ 
// Display the UIAlertView 
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:NSLocalizedString(@"new category",nil) message:NSLocalizedString(@"enter new category",nil) delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:NSLocalizedString(@"Done", nil) ,nil]; 

alert.alertViewStyle = UIAlertViewStylePlainTextInput; 
[alert show]; 
} 



// Override to support rearranging the table view. 
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath 
{ 
NSObject* objectToMove = [self.category objectAtIndex:fromIndexPath.row]; 
[self.category removeObjectAtIndex:fromIndexPath.row]; 
[self.category insertObject:objectToMove atIndex:toIndexPath.row]; 
} 

// Override to support conditional rearranging of the table view. 
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
// Return NO if you do not want the item to be re-orderable. 
return YES; 
[self.tableView reloadData]; 


} 


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
if (self.searchDisplayController.isActive) 
{ 
    [self performSegueWithIdentifier:@"DetailView" sender:self]; 
} 


    KategorienDetailTableViewController *categories = [[KategorienDetailTableViewController alloc]init]; 

    if ([[self.category objectAtIndex:indexPath.row] isEqual:@"Accessories"]) 
     categories.gewaehltInt = 0; 

    if ([[self.category objectAtIndex:indexPath.row] isEqual:@"Blouses"]) 
     categories.gewaehltInt = 1; 

    if ([[self.category objectAtIndex:indexPath.row] isEqual:@"Bras"]) 
     categories.gewaehltInt = 2; 

    if ([[self.category objectAtIndex:indexPath.row] isEqual:@"Caps"]) 
     categories.gewaehltInt = 3; 

    if ([[self.category objectAtIndex:indexPath.row] isEqual:@"Cardigans & Sweaters"]) 
     categories.gewaehltInt = 4; 

    if ([[self.category objectAtIndex:indexPath.row] isEqual:@"Dresses"]) 
     categories.gewaehltInt = 5; 

    if ([[self.category objectAtIndex:indexPath.row] isEqual:@"Hot-Pants"]) 
     categories.gewaehltInt = 6; 

    if ([[self.category objectAtIndex:indexPath.row] isEqual:@"Jackets & Coats"]) 
     categories.gewaehltInt = 7; 

    if ([[self.category objectAtIndex:indexPath.row] isEqual:@"Jackettes"]) 
     categories.gewaehltInt = 8; 

    if ([[self.category objectAtIndex:indexPath.row] isEqual:@"Jeans & Pants"]) 
     categories.gewaehltInt = 9; 

    if ([[self.category objectAtIndex:indexPath.row] isEqual:@"Leggins"]) 
     categories.gewaehltInt = 10; 

    if ([[self.category objectAtIndex:indexPath.row] isEqual:@"Longsleeves"]) 
     categories.gewaehltInt = 11; 

    if ([[self.category objectAtIndex:indexPath.row] isEqual:@"Shirts"]) 
     categories.gewaehltInt = 12; 

    if ([[self.category objectAtIndex:indexPath.row] isEqual:@"Shoes"]) 
     categories.gewaehltInt = 13; 

    if ([[self.category objectAtIndex:indexPath.row] isEqual:@"Shorts"]) 
     categories.gewaehltInt = 14; 

    if ([[self.category objectAtIndex:indexPath.row] isEqual:@"Skirts"]) 
     categories.gewaehltInt = 15; 

    if ([[self.category objectAtIndex:indexPath.row] isEqual:@"Suits"]) 
     categories.gewaehltInt = 16; 

    if ([[self.category objectAtIndex:indexPath.row] isEqual:@"Swimwear"]) 
     categories.gewaehltInt = 17; 

    if ([[self.category objectAtIndex:indexPath.row] isEqual:@"Tights"]) 
     categories.gewaehltInt = 18; 

    if ([[self.category objectAtIndex:indexPath.row] isEqual:@"Tops"]) 
     categories.gewaehltInt = 19; 

    if ([[self.category objectAtIndex:indexPath.row] isEqual:@"T-Shirts"]) 
     categories.gewaehltInt = 20; 

    if ([[self.category objectAtIndex:indexPath.row] isEqual:@"Underwear"]) 
     categories.gewaehltInt = 21; 



    //[categories setTitle:[self.category objectAtIndex:indexPath.row]]; 
    //[self.navigationController pushViewController:categories animated:YES]; 



    // [tableView deselectRowAtIndexPath:indexPath animated:YES]; 
} 

#pragma mark - Navigation 
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{ 
if([segue.identifier isEqualToString:@"DetailView"]) 
{ 
    KategorienDetailTableViewController *controller = (KategorienDetailTableViewController *)segue.destinationViewController; 
    if ([[self.category objectAtIndex:[self.tableView indexPathForSelectedRow].row] isEqual:@"Accessories"]) 
     controller.gewaehltInt = 0; 

    if ([[self.category objectAtIndex:[self.tableView indexPathForSelectedRow].row] isEqual:@"Blouses"]) 
     controller.gewaehltInt = 1; 

    if ([[self.category objectAtIndex:[self.tableView indexPathForSelectedRow].row] isEqual:@"Bras"]) 
     controller.gewaehltInt = 2; 

    if ([[self.category objectAtIndex:[self.tableView indexPathForSelectedRow].row] isEqual:@"Caps"]) 
     controller.gewaehltInt = 3; 

    if ([[self.category objectAtIndex:[self.tableView indexPathForSelectedRow].row] isEqual:@"Cardigans & Sweaters"]) 
     controller.gewaehltInt = 4; 

    if ([[self.category objectAtIndex:[self.tableView indexPathForSelectedRow].row] isEqual:@"Dresses"]) 
     controller.gewaehltInt = 5; 

    if ([[self.category objectAtIndex:[self.tableView indexPathForSelectedRow].row] isEqual:@"Hot-Pants"]) 
     controller.gewaehltInt = 6; 

    if ([[self.category objectAtIndex:[self.tableView indexPathForSelectedRow].row] isEqual:@"Jackets & Coats"]) 
     controller.gewaehltInt = 7; 

    if ([[self.category objectAtIndex:[self.tableView indexPathForSelectedRow].row] isEqual:@"Jackettes"]) 
     controller.gewaehltInt = 8; 

    if ([[self.category objectAtIndex:[self.tableView indexPathForSelectedRow].row] isEqual:@"Jeans & Pants"]) 
     controller.gewaehltInt = 9; 

    if ([[self.category objectAtIndex:[self.tableView indexPathForSelectedRow].row] isEqual:@"Leggins"]) 
     controller.gewaehltInt = 10; 

    if ([[self.category objectAtIndex:[self.tableView indexPathForSelectedRow].row] isEqual:@"Longsleeves"]) 
     controller.gewaehltInt = 11; 

    if ([[self.category objectAtIndex:[self.tableView indexPathForSelectedRow].row] isEqual:@"Shirts"]) 
     controller.gewaehltInt = 12; 

    if ([[self.category objectAtIndex:[self.tableView indexPathForSelectedRow].row] isEqual:@"Shoes"]) 
     controller.gewaehltInt = 13; 

    if ([[self.category objectAtIndex:[self.tableView indexPathForSelectedRow].row] isEqual:@"Shorts"]) 
     controller.gewaehltInt = 14; 

    if ([[self.category objectAtIndex:[self.tableView indexPathForSelectedRow].row] isEqual:@"Skirts"]) 
     controller.gewaehltInt = 15; 

    if ([[self.category objectAtIndex:[self.tableView indexPathForSelectedRow].row] isEqual:@"Suits"]) 
     controller.gewaehltInt = 16; 

    if ([[self.category objectAtIndex:[self.tableView indexPathForSelectedRow].row] isEqual:@"Swimwear"]) 
     controller.gewaehltInt = 17; 

    if ([[self.category objectAtIndex:[self.tableView indexPathForSelectedRow].row] isEqual:@"Tights"]) 
     controller.gewaehltInt = 18; 

    if ([[self.category objectAtIndex:[self.tableView indexPathForSelectedRow].row] isEqual:@"Tops"]) 
     controller.gewaehltInt = 19; 

    if ([[self.category objectAtIndex:[self.tableView indexPathForSelectedRow].row] isEqual:@"T-Shirts"]) 
     controller.gewaehltInt = 20; 

    if ([[self.category objectAtIndex:[self.tableView indexPathForSelectedRow].row] isEqual:@"Underwear"]) 
     controller.gewaehltInt = 21; 
    [controller setTitle:[self.category objectAtIndex:[self.tableView indexPathForSelectedRow].row]]; 
} 
} 


#pragma mark - UIAlertView Delegate Methods 

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex 
{ 
//Only do the following actions if user hit the Fertig Button 
if (buttonIndex == 1) 
{ 
    NSString *tmpTextField = [alertView textFieldAtIndex:0].text; 

    if (!category) 
    { 
     category = [[NSMutableArray alloc]init]; 
    } 

    [category insertObject:tmpTextField atIndex:0]; 

    NSIndexPath *indexPath1 = [NSIndexPath indexPathForRow:0 inSection:0]; 

    [self.tableView insertRowsAtIndexPaths:@[indexPath1] withRowAnimation:UITableViewRowAnimationFade]; 
} 
} 

#pragma mark iAd Delegate Methods 

-(void)bannerViewDidLoadAd:(ADBannerView *)banner 
{ 

[UIView beginAnimations:nil context:nil]; 

[UIView setAnimationDuration:0]; 

[banner setAlpha:1]; 

[UIView commitAnimations]; 

} 

-(void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error 
{ 

[UIView beginAnimations:nil context:nil]; 

[UIView setAnimationDuration:1]; 

[banner setAlpha:0]; 

[UIView commitAnimations]; 

} 




@end 

這是我的DetailViewController .h文件中:

#import <UIKit/UIKit.h> 
#import "KategorienTableViewController.h" 

@interface KategorienDetailTableViewController : UITableViewController 
{ 
NSMutableArray *accessoriesArray; 
NSMutableArray *blousesArray; 
NSMutableArray *brasArray; 
NSMutableArray *capsArray; 
NSMutableArray *cardigansandsweatersArray; 
NSMutableArray *dressesArray; 
NSMutableArray *hotpantsArray; 
NSMutableArray *jacketsandcoatsArray; 
NSMutableArray *jackettesArray; 
NSMutableArray *jeansandpantsArray; 
NSMutableArray *legginsArray; 
NSMutableArray *longsleevesArray; 
NSMutableArray *shirtsArray; 
NSMutableArray *shoesArray; 
NSMutableArray *shortsArray; 
NSMutableArray *skirtsArray; 
NSMutableArray *suitsArray; 
NSMutableArray *swimwearArray; 
NSMutableArray *tightsArray; 
NSMutableArray *topsArray; 
NSMutableArray *tshirtsArray; 
NSMutableArray *underwearArray; 
} 
@property int gewaehltInt; 
@property KategorienTableViewController *categories; 
@end 

最後,我DetailViewController.m文件:

#import "KategorienDetailTableViewController.h" 

@interface KategorienDetailTableViewController() 

@end 

@implementation KategorienDetailTableViewController 
@synthesize gewaehltInt; 
@synthesize categories; 


- (instancetype)initWithStyle:(UITableViewStyle)style 
{ 
self = [super initWithStyle:style]; 
if (self) { 
    // Custom initialization 
} 
return self; 
} 

- (void)viewDidLoad 
{ 
[super viewDidLoad]; 
accessoriesArray = [[NSMutableArray alloc]initWithObjects:@"accessories1",@"accessories2",@"accessories3",@"accessories4", nil]; 
blousesArray = [[NSMutableArray alloc]initWithObjects:@"blouses1",@"blouses2",@"blouses3",@"blouses4", nil]; 
brasArray= [[NSMutableArray alloc]initWithObjects:@"bras1",@"bras2",@"bras3",@"bras4", nil];; 
capsArray= [[NSMutableArray alloc]initWithObjects:@"Endkontrdolle",@"Versand",@"Verpackung",@"Foto's des Produktes", nil];; 
cardigansandsweatersArray= [[NSMutableArray alloc]initWithObjects:@"Endkontarolle",@"Versand",@"Verpackung",@"Foto's des Produktes", nil];; 
dressesArray= [[NSMutableArray alloc]initWithObjects:@"Endkontrocsdclle",@"Versand",@"Verpackung",@"Foto's des Produktes", nil];; 
hotpantsArray= [[NSMutableArray alloc]initWithObjects:@"Endkonsdv<trolle",@"Versand",@"Verpackung",@"Foto's des Produktes", nil];; 
jacketsandcoatsArray= [[NSMutableArray alloc]initWithObjects:@"En<vrdkontrolle",@"Versand",@"Verpackung",@"Foto's des Produktes", nil];; 
jackettesArray= [[NSMutableArray alloc]initWithObjects:@"Endkont<rvwrwrolle",@"Versand",@"Verpackung",@"Foto's des Produktes", nil];; 
jeansandpantsArray= [[NSMutableArray alloc]initWithObjects:@"Endgi kontrolle",@"Versand",@"Verpackung",@"Foto's des Produktes", nil];; 
legginsArray= [[NSMutableArray alloc]initWithObjects:@"Endkontra 4tolle",@"Versand",@"Verpackung",@"Foto's des Produktes", nil];; 
longsleevesArray= [[NSMutableArray alloc]initWithObjects:@"Endkoj zrntrolle",@"Versand",@"Verpackung",@"Foto's des Produktes", nil];; 
shirtsArray= [[NSMutableArray alloc]initWithObjects:@"Endkontr< wolle",@"Versand",@"Verpackung",@"Foto's des Produktes", nil];; 
shoesArray= [[NSMutableArray alloc]initWithObjects:@"Endkontr jdrolle",@"Versand",@"Verpackung",@"Foto's des Produktes", nil];; 
shortsArray= [[NSMutableArray alloc]initWithObjects:@"Endkon fe<trolle",@"Versand",@"Verpackung",@"Foto's des Produktes", nil];; 
skirtsArray= [[NSMutableArray alloc]initWithObjects:@"Endkonj rtrolle",@"Versand",@"Verpackung",@"Foto's des Produktes", nil];; 
suitsArray= [[NSMutableArray alloc]initWithObjects:@"Endkon wgetrolle",@"Versand",@"Verpackung",@"Foto's des Produktes", nil];; 
swimwearArray= [[NSMutableArray alloc]initWithObjects:@"Endk djontrolle",@"Versand",@"Verpackung",@"Foto's des Produktes", nil];; 
tightsArray= [[NSMutableArray alloc]initWithObjects:@"Endkoune56ntrolle",@"Versand",@"Verpackung",@"Foto's des Produktes", nil];; 
topsArray= [[NSMutableArray alloc]initWithObjects:@"Endkon4 wtatrolle",@"Versand",@"Verpackung",@"Foto's des Produktes", nil];; 
tshirtsArray= [[NSMutableArray alloc]initWithObjects:@"Endk 6ontrolle",@"Versand",@"Verpackung",@"Foto's des Produktes", nil];; 
underwearArray= [[NSMutableArray alloc]initWithObjects:@"Ena 53zdkontrolle",@"Versand",@"Verpackung",@"Foto's des Produktes", nil];; 

// Uncomment the following line to preserve selection between presentations. 
// self.clearsSelectionOnViewWillAppear = NO; 

// Uncomment the following line to display an Edit button in the navigation bar for this view controller. 
// self.navigationItem.rightBarButtonItem = self.editButtonItem; 
} 

- (void)didReceiveMemoryWarning 
{ 
[super didReceiveMemoryWarning]; 
// Dispose of any resources that can be recreated. 
} 

#pragma mark - Table view data source 

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 
{ 

// Return the number of sections. 
return 1; 
} 

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 
{ 

if (self.gewaehltInt == 0) 
{ 
    return [accessoriesArray count]; 
} 
if (self.gewaehltInt == 1) 
{ 
    return [blousesArray count]; 
} 
if (self.gewaehltInt == 2) 
{ 
    return [brasArray count]; 
} 
if (self.gewaehltInt == 3) 
{ 
    return [capsArray count]; 
} 
if (self.gewaehltInt == 4) 
{ 
    return [cardigansandsweatersArray count]; 
} 
if (self.gewaehltInt == 5) 
{ 
    return [dressesArray count]; 
} 
if (self.gewaehltInt == 6) 
{ 
    return [hotpantsArray count]; 
} 
if (self.gewaehltInt == 7) 
{ 
    return [jacketsandcoatsArray count]; 
} 
if (self.gewaehltInt == 8) 
{ 
    return [jackettesArray count]; 
} 
if (self.gewaehltInt == 9) 
{ 
    return [jeansandpantsArray count]; 
} 
if (self.gewaehltInt == 10) 
{ 
    return [legginsArray count]; 
} 
if (self.gewaehltInt == 11) 
{ 
    return [longsleevesArray count]; 
} 
if (self.gewaehltInt == 12) 
{ 
    return [shirtsArray count]; 
} 
if (self.gewaehltInt == 13) 
{ 
    return [shoesArray count]; 
} 
if (self.gewaehltInt == 14) 
{ 
    return [shortsArray count]; 
} 
if (self.gewaehltInt == 15) 
{ 
    return [skirtsArray count]; 
} 
if (self.gewaehltInt == 16) 
{ 
    return [suitsArray count]; 
} 
if (self.gewaehltInt == 17) 
{ 
    return [swimwearArray count]; 
} 
if (self.gewaehltInt == 18) 
{ 
    return [tightsArray count]; 
} 
if (self.gewaehltInt == 19) 
{ 
    return [topsArray count]; 
} 
if (self.gewaehltInt == 20) 
{ 
    return [tshirtsArray count]; 
} 
if (self.gewaehltInt == 21) 
{ 
    return [underwearArray count]; 
} 

else 
{ 
    return 1; 
} 
[self.tableView reloadData]; 

} 



- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
static NSString *CellIdentifier1 = @"DetailCell"; 
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier1 forIndexPath:indexPath]; 
if (cell == nil){ 
    cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier1]; 
} 

// Configure the cell... 
if (self.gewaehltInt == 0) cell.textLabel.text = [accessoriesArray objectAtIndex:indexPath.row]; 
if (self.gewaehltInt == 1) cell.textLabel.text = [blousesArray objectAtIndex:indexPath.row]; 
if (self.gewaehltInt == 2) cell.textLabel.text = [brasArray objectAtIndex:indexPath.row]; 
if (self.gewaehltInt == 3) cell.textLabel.text = [capsArray objectAtIndex:indexPath.row]; 
if (self.gewaehltInt == 4) cell.textLabel.text = [cardigansandsweatersArray objectAtIndex:indexPath.row]; 
if (self.gewaehltInt == 5) cell.textLabel.text = [dressesArray objectAtIndex:indexPath.row]; 
if (self.gewaehltInt == 6) cell.textLabel.text = [hotpantsArray objectAtIndex:indexPath.row]; 
if (self.gewaehltInt == 7) cell.textLabel.text = [jacketsandcoatsArray objectAtIndex:indexPath.row]; 
if (self.gewaehltInt == 8) cell.textLabel.text = [jackettesArray objectAtIndex:indexPath.row]; 
if (self.gewaehltInt == 9) cell.textLabel.text = [jeansandpantsArray objectAtIndex:indexPath.row]; 
if (self.gewaehltInt == 10) cell.textLabel.text = [legginsArray objectAtIndex:indexPath.row]; 
if (self.gewaehltInt == 11) cell.textLabel.text = [longsleevesArray objectAtIndex:indexPath.row]; 
if (self.gewaehltInt == 12) cell.textLabel.text = [shirtsArray objectAtIndex:indexPath.row]; 
if (self.gewaehltInt == 13) cell.textLabel.text = [shoesArray objectAtIndex:indexPath.row]; 
if (self.gewaehltInt == 14) cell.textLabel.text = [shortsArray objectAtIndex:indexPath.row]; 
if (self.gewaehltInt == 15) cell.textLabel.text = [skirtsArray objectAtIndex:indexPath.row]; 
if (self.gewaehltInt == 16) cell.textLabel.text = [suitsArray objectAtIndex:indexPath.row]; 
if (self.gewaehltInt == 17) cell.textLabel.text = [swimwearArray objectAtIndex:indexPath.row]; 
if (self.gewaehltInt == 18) cell.textLabel.text = [tightsArray objectAtIndex:indexPath.row]; 
if (self.gewaehltInt == 19) cell.textLabel.text = [topsArray objectAtIndex:indexPath.row]; 
if (self.gewaehltInt == 20) cell.textLabel.text = [tshirtsArray objectAtIndex:indexPath.row]; 
if (self.gewaehltInt == 21) cell.textLabel.text = [underwearArray objectAtIndex:indexPath.row]; 


return cell; 
} 
@end 
+0

與您的錯誤無關,但我建議您使用其他數組並將所有數組放入其中。然後,而不是所有你的if/else(在'tableView:numberOfRowsInSection:'和'tableView:cellForRowAtIndexPath'中,你可以做'[yourArray objectAtIndex:self.gewaehltInt];'而是分別返回[[yourArray objectAtIndex:self.gewaehltInt ] count];''和'cell.textLabel.text = [[yourArray objectAtIndex:self.gewaehltInt] objectAtIndexPath:indexPath.row];' – Larme

+0

Typo?錯誤是關於'KategorienTableViewDetailControllerViewController',但你的類被命名爲'KategorienDetailTableViewController'。你輸入IB的名字 – rmaddy

+0

@rmaddy它錯在哪裏?對不起,但我找到它了! – user3734506

回答

0

轉到項目導航器中的項目故事板文件,並查找將其視圖控制器自定義類設置爲「KategorienTableViewDetailControllerViewController」的場景。將其更改爲「KategorienDetailTableViewController」如果這是您要分配的類。

我假設您將KategorienTableViewDetailControllerViewController重命名爲KategorienDetailTableViewController,但該更改未在故事板任務中生效。

+0

我刪除了該視圖控制器,並創建一個新的。但沒有視圖控制器確實有舊cl屁股。 IT必須是另一個問題。 – user3734506

+0

好的,但是你編輯故事板是否知道新的視圖控制器? – rfox

+0

是的I.編輯故事板 – user3734506

0

轉到故事板,選擇ViewController,然後在右側窗格中,單擊屬性檢查器框中的右箭頭,在最右側單擊右箭頭,當它懸停在它上面時,表示Connections Inspectorr。

然後你會看到你所有的鏈接對象,嘗試刪除你認爲你刪除的那個。

如果這不起作用,請檢查ViewController中的dealloc方法,有時會在那裏釋放對象。

+0

我沒有dealloc方法。我使用ARC – user3734506

相關問題