Pregunta

Me gustaría volver a cargar una vista de tabla que está en otra clase llamada "WriteIt_MobileAppDelegate" de una de mis otras clases que se llama "Propiedades". He tratado de hacerlo a través de la clase NSNotificationCenter -. El registro se vuelve a llamar, pero la tabla no se actualiza nunca

Properties.h:

 [[NSNotificationCenter defaultCenter] postNotificationName:@"NameChanged"
              object:[WriteIt_MobileAppDelegate class]
               userInfo:nil]; 

WriteIt_MobileAppDelegate.m

  

- (void) {awakeFromNib

     

[[NSNotificationCenter defaultCenter] addObserver: auto               Selector: @selector (reloadItProperties :)                Nombre: @ "NameChanged" objeto: auto];

     

}

- (void) reloadItProperties: (NSNotification *)notification {

 NSLog(@"Reloading Data"); //this gets called
[[self navigationController] dismissModalViewControllerAnimated:YES];
[self.navigationController popToRootViewControllerAnimated:YES];
 [self.tblSimpleTable reloadData];
 [self.tblSimpleTable reloadSectionIndexTitles];
 // but the rest doesn't
}

¿Qué estoy haciendo mal aquí?

¿Fue útil?

Solución

Parece que está utilizando el parámetro incorrecto object:

addObserver: selector: nombre: objeto:

  

notificationSender
  El objeto cuya   notificaciones del observador quiere   recibir;
  Es decir, sólo las notificaciones   enviado por este remitente se entregan a   el observador. Si pasa cero, el   centro de notificación no utiliza una   remitente de la notificación para decidir   ya sea para entregarlo al observador.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top