日別アーカイブ: 2014年9月7日

SearchBar

SearchBarの遷移先でObjectを変更すると、エラーになる件。
ERROR
2014-09-07 13:05:38.832 BeppuSpa88[13043:60b] mainview coredata exist don’t anything!!
2014-09-07 13:05:46.250 BeppuSpa88[13043:60b] *** Assertion failure in -[UITableView _endCellAnimationsWithContext:], /SourceCache/UIKit_Sim/UIKit-2935.137/UITableView.m:1352
2014-09-07 13:05:46.262 BeppuSpa88[13043:60b] CoreData: error: Serious application error. An exception was caught from the delegate of NSFetchedResultsController during a call to -controllerDidChangeContent:. Invalid update: invalid number of sections. The number of sections contained in the table view after the update (2) must be equal to the number of sections contained in the table view before the update (11), plus or minus the number of sections inserted or deleted (0 inserted, 0 deleted). with userInfo (null)

//
@property Boolean IsSearchTable;
//
//
@synthesize IsSearchTable;
//

NORMAL VIEW か SEARCHBARか確認した上で処理することで対応。

//
//----------------------------------------------------------------------------
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    if ([[segue identifier] isEqualToString:@"showDetail"]) {
        if(sender == self.searchDisplayController.searchResultsTableView) {
            // サーチビュー
            NSIndexPath *indexPath = [self.searchDisplayController.searchResultsTableView indexPathForSelectedRow];
            NSManagedObject *object = [[self fetchedResultsController] objectAtIndexPath:indexPath];
            [[segue destinationViewController] setDetailItem:object];

            //SearchBarの遷移先でObjectを変更すると、エラーになる件についての対策
            [[segue destinationViewController] setIsSearchTable:YES];
        }
        else {
            // ノーマルビュー
            NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
            NSManagedObject *object = [[self fetchedResultsController] objectAtIndexPath:indexPath];
            [[segue destinationViewController] setDetailItem:object];

            //SearchBarの遷移先でObjectを変更すると、エラーになる件についての対策
            [[segue destinationViewController] setIsSearchTable:NO];
        }
    }  else if ([[segue identifier] isEqualToString:@"showflip"]) {
        [[segue destinationViewController] setDelegate:self];

        // 現在のFetche_predicate_strをflipviewに通知。
        [[segue destinationViewController] setFlipout_str:Fetche_predicate_str];
    }
}
//----------------------------------------------------------------------------
//
//
    //動作確認用
    NSLog(@"IsSearchTable = %hhu",IsSearchTable);
    //self.title=[NSString stringWithFormat:@"%@",[[_detailItem valueForKey:@"name"] description]];
    //温泉入湯チェックボタン追加 of_off
    //SearchBarにより遷移するとERROR発生。さて…とりあえずコメントアウト次なる手を。。。
    //次の一手
    if (IsSearchTable == NO) {
        [_detailItem setValue:[NSNumber numberWithBool:YES] forKey:@"on_off"];
    }
    //-----------------------------
//

平成26年9月7日(日曜日)

DetailTableViewを非table版に変更。

segue → showDetail(push)

SearchBarの遷移先でObjectを変更すると、エラーになる件。
ERROR
2014-09-07 13:05:38.832 BeppuSpa88[13043:60b] mainview coredata exist don’t anything!!
2014-09-07 13:05:46.250 BeppuSpa88[13043:60b] *** Assertion failure in -[UITableView _endCellAnimationsWithContext:], /SourceCache/UIKit_Sim/UIKit-2935.137/UITableView.m:1352
2014-09-07 13:05:46.262 BeppuSpa88[13043:60b] CoreData: error: Serious application error. An exception was caught from the delegate of NSFetchedResultsController during a call to -controllerDidChangeContent:. Invalid update: invalid number of sections. The number of sections contained in the table view after the update (2) must be equal to the number of sections contained in the table view before the update (11), plus or minus the number of sections inserted or deleted (0 inserted, 0 deleted). with userInfo (null)

解決済み、SEARCHBARカテゴリ参照。

他に、
ラベルに表示されない件について
detail viewのviewDidLoadに[self configureView]を追加して、解決。

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self configureView];
    _view2.backgroundColor=[UIColor colorWithRed:0.96 green:0.96 blue:0.86 alpha:0.3];
}

画面遷移の変更

MapViewController.m
    //
    //DetailTableViewController *mycontroller = [self.storyboard instantiateViewControllerWithIdentifier:@"registered"];
    DetailTableViewController *mycontroller = [self.storyboard instantiateViewControllerWithIdentifier:@"registered2"];
    //