我不知道发生了什么,但是当我使用UITableViewController
时我的应用程序崩溃了我有这样的信息:
Terminating app due to uncaught exception 'NSInternalInconsistencyException',
reason: 'Could not load NIB in bundle:
'NSBundle </Users/david/Library/Application Support/iPhone Simulator/5.1/Applications/F6052770-1241-4FC0-BBFB-2C73161E6ED4/test.com.app>
(loaded)' with name 'FWF-vb-mRj-view-dXw-hN-hWq''
我构建了一个新的tableview并在新的tableview中复制了我的所有代码,但又崩溃了。我只使用故事板
编辑:我有这个警告:Scene is unreachable due to lack of entry points and does not have an identifier for runtime access via -instantiateViewControllerWithIdentifier"
我开始疯狂了
完整代码:
- (id)initWithStyle:(UITableViewStyle)style
{
self = [super initWithStyle:style];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
-(void)mesInfos
{
AppDelegate *app = [[UIApplication sharedApplication]delegate];
infoArray = [[NSArray alloc]init ];
NSMutableArray *array = [NSMutableArray arrayWithArray:app.listePseudoArray];
NSPredicate *bPredicate = [NSPredicate predicateWithFormat:@"pseudo like %@",app.monPseudo ];
infoArray = [array filteredArrayUsingPredicate:bPredicate];
//app.mesInfos = self.infoArray;
NSLog(@" données pseudo %@",infoArray);
[self contact];
}
-(void)contact
{
AppDelegate *app = [[UIApplication sharedApplication]delegate];
NSUInteger countr = [app.amisArray count];
contactStr = [NSString stringWithFormat:@"%d",countr ];
NSLog(@" données contactStr %@",contactStr);
[compteTBView reloadData];
[self imageCache];
}
-(void)imageCache
{
NSString *documentsDirectory;
NSArray* paths =NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
documentsDirectory = [paths objectAtIndex:0];
documentsDirectory = [documentsDirectory stringByAppendingPathComponent:@"imageCache/"];
objMan = [[HJObjManager alloc] initWithLoadingBufferSize:6 memCacheSize:20];
HJMOFileCache *fileCache = [[HJMOFileCache alloc] initWithRootPath:documentsDirectory];
objMan.fileCache = fileCache;
fileCache.fileCountLimit = 5000;
fileCache.fileAgeLimit = 60+60+24+7;
[fileCache trimCacheUsingBackgroundThread];
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
//messLab.text = message;
[self mesInfos];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
// Return the number of sections.
return 4;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
switch (section) {
case 0:
return 2;
case 1:
return 2;
case 2:
return 3;
case 3:
return 5;
default:
return 1;
}
}
-(CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
if(indexPath.section == 0)
{
switch (indexPath.row)
{
case 0:
return 180;
break;
case 1:
return 44;
break;
}
}
if(indexPath.section == 1)
{
switch (indexPath.row)
{
case 0:
return 44;
break;
case 1:
return 44;
break;
}
}
if(indexPath.section == 2)
{
switch (indexPath.row)
{
case 0:
return 44;
break;
case 1:
return 44;
break;
case 2:
return 44;
break;
}
}
if(indexPath.section == 3)
{
switch (indexPath.row)
{
case 0:
return 44;
break;
case 1:
return 44;
break;
case 2:
return 44;
break;
case 3:
return 44;
break;
case 4:
return 44;
break;
}
}
return 44;
}
#define kTagImageView 70
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell1";
static NSString *CellIdentifier2 = @"Cell2";
static NSString *CellIdentifier3 = @"Cell3";
static NSString *CellIdentifier4 = @"Cell4";
static NSString *CellIdentifier5 = @"Cell5";
static NSString *CellIdentifier6 = @"Cell6";
static NSString *CellIdentifier7 = @"Cell7";
static NSString *CellIdentifier8 = @"Cell8";
static NSString *CellIdentifier9 = @"Cell9";
static NSString *CellIdentifier10 = @"Cell10";
static NSString *CellIdentifier11 = @"Cell11";
static NSString *CellIdentifier12 = @"Cell12";
if(indexPath.section == 0)
{
switch (indexPath.row)
{
case 0:
{
CompteCell* cell =(CompteCell*) [compteTBView dequeueReusableCellWithIdentifier:CellIdentifier];
HJManagedImageV *imageV=(HJManagedImageV*) [cell viewWithTag:kTagImageView];
[imageV clear];
[imageV showLoadingWheel];
[imageV setUrl : [ NSURL URLWithString:[[infoArray objectAtIndex:0]valueForKey:@"photo"]]];
[objMan manage:imageV];
return cell;
}
break;
case 1:
{
CompteCell* cell =(CompteCell*) [compteTBView dequeueReusableCellWithIdentifier:CellIdentifier2];
cell.textLabel.text = @"Photo";
cell.detailTextLabel.text = @"Modifiez votre photo";
return cell;
}
break;
}
}
if(indexPath.section == 1)
{
switch (indexPath.row)
{
case 0:
{
CompteCell* cell =(CompteCell*) [compteTBView dequeueReusableCellWithIdentifier:CellIdentifier3];
cell.textLabel.text = @"Pseudo iChat";
cell.detailTextLabel.text = [[infoArray objectAtIndex:0]valueForKey:@"pseudo"];
cell.detailTextLabel.textColor = [UIColor grayColor];
cell.accessoryType= UITableViewCellSelectionStyleNone;
return cell;
}
break;
case 1:
{
CompteCell* cell =(CompteCell*) [compteTBView dequeueReusableCellWithIdentifier:CellIdentifier4];
cell.textLabel.text = @"Sexe";
cell.detailTextLabel.text = [[infoArray objectAtIndex:0]valueForKey:@"sexe"];
cell.detailTextLabel.textColor = [UIColor grayColor];
return cell;
}
break;
}
}
if(indexPath.section == 2)
{
switch (indexPath.row)
{
case 0:
{
CompteCell* cell =(CompteCell*) [compteTBView dequeueReusableCellWithIdentifier:CellIdentifier5];
if ([[[infoArray objectAtIndex:0]valueForKey:@"statut"] isEqualToString:@""])
{
cell.detailTextLabel.text = @"Aucun message";
cell.detailTextLabel.textColor = [UIColor grayColor ];
cell.textLabel.text = @"Message";
}
else
{
NSString *aMsg = [[[infoArray objectAtIndex:0]valueForKey:@"statut"]stringByReplacingOccurrencesOfString:@"é" withString:@"é"];
message = [aMsg stringByReplacingOccurrencesOfString:@"è" withString:@"è"];
cell.detailTextLabel.text =message;
cell.textLabel.text = @"Message";
}
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell;
}
break;
case 1:
{
CompteCell* cell =(CompteCell*) [compteTBView dequeueReusableCellWithIdentifier:CellIdentifier6];
NSString *aMsg = [[[infoArray objectAtIndex:0]valueForKey:@"etat"]stringByReplacingOccurrencesOfString:@"é" withString:@"é"];
NSString* aMsg2 = [aMsg stringByReplacingOccurrencesOfString:@"è" withString:@"è"];
cell.detailTextLabel.text =aMsg2;
cell.textLabel.text = @"Statut";
if ([aMsg2 isEqualToString:@"Disponible"])
{
cell.detailTextLabel .textColor = [UIColor greenColor];
}
else if ([aMsg2 isEqualToString:@"Occupé"])
{
cell.detailTextLabel .textColor = [UIColor orangeColor];
}
else if ([aMsg2 isEqualToString:@"Absent"])
{
cell.detailTextLabel .textColor = [UIColor redColor];
}
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell;
}
break;
case 2:
{
CompteCell* cell =(CompteCell*) [compteTBView dequeueReusableCellWithIdentifier:CellIdentifier7];
cell.textLabel.text = @"Nombre de contact";
if ([contactStr isEqualToString:@"0"])
{
cell.detailTextLabel.text = @"Aucun";
//cell.detailTextLabel.text = contactStr;
}
else {
cell.detailTextLabel.text = contactStr;
}
return cell;
}
break;
}
}
if(indexPath.section == 3)
{
switch (indexPath.row)
{
case 0:
{
CompteCell* cell =(CompteCell*) [compteTBView dequeueReusableCellWithIdentifier:CellIdentifier8];
cell.textLabel.text = @"Age";
cell.detailTextLabel.text= [NSString stringWithFormat:@"%@ ans", [[infoArray objectAtIndex:0]valueForKey:@"age"]];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell;
}
break;
case 1:
{
CompteCell* cell =(CompteCell*) [compteTBView dequeueReusableCellWithIdentifier:CellIdentifier9];
cell.detailTextLabel.text = [[infoArray objectAtIndex:0]valueForKey:@"email"];
cell.textLabel.text = @"Email";
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell;
}
break;
case 2:
{
CompteCell* cell =(CompteCell*) [compteTBView dequeueReusableCellWithIdentifier:CellIdentifier10];
cell.textLabel.text = @"Mot de passe";
cell.detailTextLabel.text =@"le modifier";
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell;
}
break;
case 3:
{
CompteCell* cell =(CompteCell*) [compteTBView dequeueReusableCellWithIdentifier:CellIdentifier11];
cell.textLabel.text = @"Département";
cell.detailTextLabel.text = [[infoArray objectAtIndex:0]valueForKey:@"localite"];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell;
}
break;
case 4:
{
CompteCell* cell =(CompteCell*) [compteTBView dequeueReusableCellWithIdentifier:CellIdentifier12];
cell.detailTextLabel.text = [[infoArray objectAtIndex:0]valueForKey:@"dateMembre"];
cell.textLabel.text = @"Membre depuis le";
cell.detailTextLabel.textColor = [UIColor grayColor];
return cell;
}
break;
}
}
return nil;
}
-(IBAction)quitter:(id)sender
{
}
-(void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex
{
if(actionSheet.tag == 15)
{
switch (buttonIndex)
{
case 0:
{
NSLog(@"YEEES");
ViewController *view = [self.storyboard instantiateViewControllerWithIdentifier:@"accueil"];
view.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:view animated:YES];
}
}
}
}