-(UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *cellIdentifier = @"cell";
if (tableView ==tableview1) {
ContactCustom *cell1=(ContactCustom *) [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell1 == nil) {
[[NSBundle mainBundle] loadNibNamed:@"ContactCustom" owner:self options:nil];
cell1 = contactCustom;
}
NSString *nameStr = [newcontactList objectAtIndex:indexPath.row];
NSArray * arr = [nameStr componentsSeparatedByString:@"!"];
NSLog(@"arr %@\n",arr);
[cell1 ContactNameText:[arr objectAtIndex:0]];
[cell1 MobileNoText:[arr objectAtIndex:1]];
if (![[arr objectAtIndex:3] isEqualToString:@"no"]) {
[cell1 ScreenNameText:[arr objectAtIndex:3]];
}
if (![[arr objectAtIndex:4] isEqualToString:@"0"]) {
[cell1 setImg:[arr objectAtIndex:4]];
}
else
{
cell1.receiveCountBtn.hidden=YES;
}
cell1.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
cell1.selectionStyle = UITableViewCellSelectionStyleNone;
return cell1;
}
else if (tableView ==tableview2) {
ContactPicsCustom *cell=(ContactPicsCustom *) [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell == nil) {
[[NSBundle mainBundle] loadNibNamed:@"ContactPicsCustom" owner:self options:nil];
cell = contactPicsCustom;
}
NSString *nameStr = [sentPicsContactList objectAtIndex:indexPath.row];
NSArray * arr1 = [nameStr componentsSeparatedByString:@"!"];
// NSLog(@"arr1 %@\n",arr1);
User *userObj = [[User alloc]init];
userObj.fName = [arr1 objectAtIndex:0];
userObj.mNo = [arr1 objectAtIndex:1];
// NSLog(@"user %@ %@\n",userObj.fName,userObj.mNo);
[cell ContactNameText:[arr1 objectAtIndex:0]];
if ([arr1 count] == 4) {
[cell ScreenNameText:[arr1 objectAtIndex:3]];
}
// [cell setImg:[dicPhotosCount valueForKey:[arr1 objectAtIndex:0]]];
NSInteger cnt = [[DBModel database]photosCnt:userObj];
// NSLog(@"cnt: %d\n",cnt);
if(cnt >= 1)
{
[cell setImg:[NSString stringWithFormat:@"%d",cnt]];
}
else
{
cell.imgView.hidden=YES;
}
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
}
return 0;
}
私はtabBarController
自分のプロジェクトに追加しました。コードの何が問題になっていますか?tabBarItem
ContactsViewController
ContactsViewController
UITableView
tableView:cellForRowAtIndexPath
-(void) tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController
{
if (tabBarController.selectedIndex == 0) {
}
else if (tabBarController.selectedIndex == 1) {
UINavigationController *requiredNavigationController = [tabBarController.viewControllers objectAtIndex:1];
[requiredNavigationController popToRootViewControllerAnimated:YES];
}
上記のメソッドをAppdelegate.miに追加した後、例外が発生しています