#ios #xcode #debugging #uitableview #int
#iOS #xcode #отладка #uitableview #int
Вопрос:
мое приложение выходит из строя, когда я нажимаю на UITableViewCell с помощью SIGNAL1: SIGABRT. Вот мой код ошибки:
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 amp; Sweaters"];
[self.category addObject:@"Dresses"];
[self.category addObject:@"Hot-Pants"];
[self.category addObject:@"Jackets amp; Coats"];
[self.category addObject:@"Jackettes"];
[self.category addObject:@"Jeans amp; 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 amp; 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 amp; Coats"])
categories.gewaehltInt = 7;
if ([[self.category objectAtIndex:indexPath.row] isEqual:@"Jackettes"])
categories.gewaehltInt = 8;
if ([[self.category objectAtIndex:indexPath.row] isEqual:@"Jeans amp; 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 amp; 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 amp; 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 amp; 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
Комментарии:
1. Ничего общего с вашей ошибкой, но я предлагаю вам использовать другой массив и поместить в него весь ваш массив. Затем вместо всех ваших if/else (в
tableView:numberOfRowsInSection:
иtableView:cellForRowAtIndexPath
, вы можете сделать[yourArray objectAtIndex:self.gewaehltInt];
вместо этого, соответственно return [[YourArray objectAtIndex:self.gewaehltInt] count];` иcell.textLabel.text = [[yourArray objectAtIndex:self.gewaehltInt] objectAtIndexPath:indexPath.row];
2. Опечатка? Ошибка примерно
KategorienTableViewDetailControllerViewController
, но ваш класс названKategorienDetailTableViewController
. Исправьте имя, которое вы ввели в IB.3. @rmaddy Где это неправильно? Извините, но я и это нахожу!
4. Возможно, есть какой-то выход с anme
gewaehlteKategorie
, который вы забыли удалить в IB. Проверьте свои подключения к розетке и класс viewcontroller.5. Нет, я ничего не нахожу…
Ответ №1:
Перейдите к файлу раскадровки вашего проекта в навигаторе проекта и найдите сцену, для которой установлен пользовательский класс контроллера представления «KategorienTableViewDetailControllerViewController». Измените это на «KategorienDetailTableViewController», если это класс, который вы хотели назначить.
Я предполагаю, что вы переименовали KategorienTableViewDetailControllerViewController в KategorienDetailTableViewController, но это изменение не вступило в силу в назначениях раскадровки.
Комментарии:
1. Я удалил этот контроллер представления и создал новый. Но ни у одного контроллера представления нет старого класса. Должно быть, это другая проблема.
2. Хорошо, но вы отредактировали раскадровку, чтобы она знала о новом контроллере представления?
3. Вот еще один способ поиска проблемы в раскадровке. Щелкните правой кнопкой мыши на файле раскадровки в навигаторе проекта и выберите Открыть как> Исходный код во всплывающем окне. При этом раскадровка будет отображаться в виде текста XML. В представлении файла вы можете выполнить поиск по KategorienTableViewDetailControllerViewController и gewaehlteKategorie, чтобы узнать, остались ли какие-либо ссылки на более старый контроллер представления.
4. Нет, я ничего не нахожу
Ответ №2:
перейдите в раскадровку, выберите ViewController, затем на правой боковой панели нажмите на стрелку вправо в окне инспектора атрибутов, в самой правой части нажмите на стрелку вправо, при наведении на нее написано Connections Inspectorr.
затем вы увидите все ваши связанные объекты, попробуйте удалить тот, который, как вы думали, вы удалили.
Если это не сработает, проверьте свой метод dealloc в ViewController, иногда он освобождает объект там.
Комментарии:
1. У меня нет метода освобождения. Я использую ARC