Hi guys I have the following code:
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
static NSString *LocationHeaderCellIdentifier = @"Location Header Cell";
LocationHeaderCell *locationHeaderCell;
locationHeaderCell = (LocationHeaderCell *)[tableView dequeueReusableCellWithIdentifier:LocationHeaderCellIdentifier];
locationHeaderCell.lblCurrentAddress.text = self.currentAddress;
return locationHeaderCell;
}
As you guys can see, I am using a prototype cell to be my header. What I want to accomplish is to access this header in the didUpdateLocation delegate to change a label (refresh it). I do not want to use [reload data]
because I am receiving two different responses from different web servers. One from Parse and another from Apple. Therefore I do not know which one will come first. I try to retrieve the header view and it prints Null.
Any suggestions?
You could keep a reference to this LocationHeaderCell
in a property for example:
@property(nonatomic, strong) LocationHeaderCell *myHeader;
and modify your code like this:
if (self.myHeader==nil)
self.myHeader = (LocationHeaderCell *)[tableView dequeueReusableCellWithIdentifier:LocationHeaderCellIdentifier];
so in didUpdateLocation
just do a self.myHeader.lblCurrentAddress.text = @whatever";
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.