所以我所拥有的是一个激活的pop,它有自己的ViewController和XIB文件。它有一个名为@property (strong, nonatomic) IBOutlet UILabel *addressLabel;
的标签问题是我试图在第一个VC(调用弹出窗口)中调用该标签,因为这是我查询数据库以使用DB中的名称填充标签的地方。我可以将* addressLabel设为全局,以便在主VC中重新识别吗?
以下是调用pop的主要VC
- (void)receivedSighting:(FYXVisit *)visit updateTime:(NSDate *)updateTime RSSI:(NSNumber *)RSSI;
{
NSLog(@"Gimbal Beacon!!! %@", visit.transmitter.name);
// this will be invoked when an authorized transmitter is sighted during an on-going visit
[self showTransmittersView];
//This gets the popup
SamplePopupViewController *samplePopupViewController = [[SamplePopupViewController alloc] initWithNibName:@"SamplePopupViewController" bundle:nil];
[self presentPopupViewController:samplePopupViewController animated:YES completion:nil];
PFQuery *query = [PFQuery queryWithClassName:@"houses"];
[query whereKey:@"name" equalTo:[NSString stringWithFormat:@"%@",visit.transmitter.name]];
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
if (!error) {
for (PFObject *object in objects) {
NSLog(@"address: %@", [object objectForKey:@"address"]);
NSLog(@"url:: %@", [object objectForKey:@"url"]);
NSString *displayAddress = [NSString stringWithFormat:@"%@", [object objectForKey:@"address"]];
NSString *displayDescription = [NSString stringWithFormat:@"%@", [object objectForKey:@"description"]];
NSString *displayUrl = [NSString stringWithFormat:@"%@", [object objectForKey:@"url"]];
//This is where I was getting the info to put in the pop up label
self.addressLabel.text = displayAddress;
}
} else {
// Log details of the failure
NSLog(@"Error: %@ %@", error, [error userInfo]);
}
}];
}