I'm working with the sticky header flow layout (https://github.com/jamztang/CSStickyHeaderFlowLayout) on my project, but am running into trouble with the mapview in the header. The collection view header is a my custom class HeaderMapViewCell
that subclasses UICollectionViewCell
and has an IBOutlet to an MKMapView
, but it doesn't display any annotations or fire any actions for that matter, even though it's properties do change (when i print them in the debugger).
Basically this is my setup
UICollectionViewController -> CollectionView -> HeaderMapViewCell -> MapView
Also for example here:
-(IBAction)changeData:(UISegmentedControl*)sender{
if (_mapView.mapType == MKMapTypeStandard)
[_mapView setMapType:MKMapTypeSatellite];
else
[_mapView setMapType:MKMapTypeStandard];
if(sender.selectedSegmentIndex==0)
_displayStudents = YES;
else
_displayStudents = NO;
[self.collectionView reloadData];
}
When i fire this method, nothing on the map changes, but when i put a breakpoint, the mapview's property does indeed change, just never displays anything visually!
The View controllers mapview delegate methods get fired partially. RegionDidChangeAnimated gets fired once on loading, then when i zoom in it doens't get fired. On the other hand, viewForAnnotation does get called and returns the correct object, but never displays anything. I'm doing something wrong with the mapview, just not sure what. Let me know if you have an idea, or if you need me to post more code or anything! Thanks!