Estoy atascado :(
En mi aplicación, necesito una actualización de CLLocationManager cada vez que se actualiza a una nueva posición. No estoy usando archivos XIB/NIB, todo lo que he codificado lo he hecho programáticamente. :?
el .h¿Cómo actualizar un UILabel en Xcode mediante programación sin archivos XIB?
@interface TestViewController : UIViewController
UILabel* theLabel;
@property (nonatomic, copy) UILabel* theLabel;
@end
la .m
...
-(void)loadView{
....
UILabel* theLabel = [[UILabel alloc] initWithFrame:CGRectMake(0.0,0.0,320.0,20.0)];
theLabel.text = @"this is some text";
[self.view addSubView:theLabel];
[theLabel release]; // even if this gets moved to the dealloc method, it changes nothing...
}
- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation
{
NSLog(@"Location: %@", [newLocation description]);
// THIS DOES NOTHING TO CHANGE TEXT FOR ME... HELP??
[self.view.theLabel setText:[NSString stringWithFormat: @"Your Location is: %@", [newLocation description]]];
// THIS DOES NOTHING EITHER ?!?!?!?
self.view.theLabel.text = [NSString stringWithFormat: @"Your Location is: %@", [newLocation description]];
}
...
todas las ideas, o ayudar a
(esto estaba a tope toda la mano así que por favor, perdónenme si parece un poco cerrado) Puedo proporcionar más información si es necesario.
¿El NSLog muestra la ubicación correcta? – GorillaPatch
¿No te refieres a viewDidLoad? –
@Radek Lo puse en loadView, ¿debería colocarse UILabel en viewDidLoad? ¿Ese es el punto de anulación? Y por qué eso haría mudable a UILabel –