개체 10 개를 가져 오는 쿼리가 있는데 선택한 개체에 대한 자세한 정보가있는 창을 표시하는 작업이 있습니다. Xcode에 익숙하지 않은 이유를 알 수 없습니다. 정보를 새보기 컨트롤러로 푸시합니다. 다음은 쿼리를 생성하는 코드입니다.쿼리 개체를 컨트롤러에 보냅니다.
PFQuery *query = [PFQuery queryWithClassName:@"Arcade"];
CLLocation *currentLocation = locationManager.location;
PFGeoPoint *userLocation =
[PFGeoPoint geoPointWithLatitude:currentLocation.coordinate.latitude
longitude:currentLocation.coordinate.longitude];
query.limit = 10;
[query whereKey:kPAWParseLocationKey nearGeoPoint:userLocation withinMiles:kPAWWallPostMaximumSearchDistance];
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
if (!error) {
// The find succeeded.
NSLog(@"Successfully retrieved %d scores.", objects.count);
// Do something with the found objects
int i = 0;
for (PFObject *object in objects) {
if (i >= [self.EventTitles count]) break;//to make sure we only write up to the max number of UILabels available in EventTitles
[(UILabel *)self.EventTitles[i] setText:[object objectForKey:@"name"]];//I assume the "objectId" property of object is an NSString!
i++;
}
} else {
// Log details of the failure
NSLog(@"Error: %@ %@", error, [error userInfo]);
}
}];
이 새로운 뷰 컨트롤러에 밀어 작업입니다 : 누군가가 나를에 추가해야합니다 코드의 한 라인을 작성하는 데 도움 수 있다면
-(IBAction)DetailEvent1:(id)sender{
TableDetailViewController *objDetail = [[TableDetailViewController alloc] initWithNibName:@"TableDetailViewController" bundle:nil];
[self addChildViewController:objDetail];
objDetail.view.frame = CGRectMake(0.0f, 0.0f, 320.0f, self.view.bounds.size.height - 0.0f);
[self.view addSubview:objDetail.view];
}
DetailEvent1 액션을 사용하여 선택한 객체를 밀어 넣으면 크게 감사하겠습니다.
모든 것이 의미가 있지만 어느 컨트롤러에서도 쿼리가 선언되지 않는다는 것이 맞습니다. 어떻게 쿼리를 선언해야합니까? – user3205645
Objective-C와 객체 및 클래스 작동 방법을 배우는 것이 좋습니다. [재산이란 무엇입니까] (http://www.apeth.com/iOSBook/ch12.html#_properties_2) 및 신고 방법 ... 그리고 왜 ... – matt