셀 배열로 UITableview를 채우려고합니다. 보통 viewDidLoad 메서드에서이 작업을 수행하지만 이번에는 위치를 기반으로 배열을 채 웁니다.iPhone SDK에서 CLLocationManagerDelegate의 didUpdateToLocation 메서드를 기다리는 중 UITableView가 채워지지 않습니다.
@interface RootViewController : UITableViewController
<UITableViewDelegate, UITableViewDataSource, CLLocationManagerDelegate> {
구현 파일에서의 viewDidLoad 방법은 다음과 같습니다 :
self.title = @"Open Buildings";
NSMutableArray *buildingArray = [[NSMutableArray alloc] initWithObjects:building1,
self.controllers = array;
:
- (void)viewDidLoad {
// for location
self.locationManager = [[CLLocationManager alloc] init];
[locationManager startUpdatingLocation];
locationManager.delegate = self;
locationManager.distanceFilter = kCLDistanceFilterNone;
locationManager.desiredAccuracy = kCLLocationAccuracyBest;
[super viewDidLoad];
}
내가 didUpdateToLocation 방법에서 세포의 배열을 채울 아래 내 인터페이스의 첫 번째 줄입니다
위치가 있지만 배열이 채워지지 않을 때 뷰 제목이 업데이트됩니다. 위의 코드를 viewdidupdate에 넣었을 때 배열이 채워져있었습니다. 뷰를 viewDidLoad 메서드에서로드 할 때 응용 프로그램에 위치 정보가 없기 때문에이 메서드를 didupdatelocation 메서드로 옮겨야했습니다.
구현 클래스가 tableview이고 내 nib 파일이 아닌 경우 tableview를 다시로드하는 방법은 무엇입니까? – Atma
ivar 또는 outlet 중 하나에 대한 참조를 설정해야합니다. @ 인터페이스의 RootViewController :있는 UITableViewController { –
August
. 내가 뭐 잘못하고 있니? – Atma