속도에 대한 내 uilabel에 대한 정수를 업데이트하고 싶지만 작동하지 않는 것 같습니다. 기본적인 질문은 있지만 지금은이 버그가 있습니다. mainviewcontroller.xib 뷰를 만들고 Uilabel을 설정하려고했지만 업데이트하지 않습니다. 내 uilabel은 speedView라고합니다UIlabel이 업데이트되지 않고 이동하는 차량이나 자전거 등의 속도를 업데이트하고 싶습니다.
- (void)viewDidLoad {
[super viewDidLoad];
CLController = [[CoreLocationController alloc] init];
CLController.delegate = self;
[CLController.locMgr startUpdatingLocation];
}
- (void)locationUpdate:(CLLocation *)location {
NSNumber *speedCount = [NSNumber numberWithInt:1];
[speedView setText: [NSString stringWithFormat:@"number is %@d",speedCount]];
}
- (void)locationError:(NSError *)error {
speedView.text = [error description];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
return YES;
}
- (void)viewDidUnload {
}
- (void)dealloc {
[CLController release];
[super dealloc];
}
@end
@interface MainViewController : UIViewController <LoginDelegate,WEPopoverParentView,PopoverControllerDelegate,MainMenuDelegate,MKMapViewDelegate,UIActionSheetDelegate, CLLocationManagerDelegate>
{
AppDelegate *appDelegate;
IBOutlet MKMapView *userMap;
IBOutlet UILabel *speedView;
}
@property (strong, nonatomic) IBOutlet UILabel *speedView;
@property(nonatomic) int speedCount;
- (void)setSpeedView:(UILabel *)speedView;
나에게 아이디어를 제안하는 사람이 있습니까? 나는 그 가치가 왜 나오지 않는지에 대한 생각을했다.
'locationUpdate :'가 실제로 호출되고 있는지 확인 했습니까? 그렇다면'speedView'가'nil'이 아니라는 것을 확인 했습니까? – rmaddy
방금 nil로 설정했는지 확인했는데 변경하려면 어떻게해야합니까? – mrorgon
'speedView'가'IBOutlet'이라면, IB에서 제대로 연결되었는지 확인하십시오. – rmaddy