SGARNavigationViewControllerDataSource


 The data source provides all callback methods that build the bucket list structure for the SGARNavigationController.

Declared In: SGARNavigationViewController.h

Discussion

There are three required methods that need to be implemented. Each are important to creating and building the bucket list structure within the SGARNavigationController and, consequentally, the arView . The single, optional method viewController:didAddAnnotationView: allows the data source to be aware when new views have been loaded into the AR enviornment.



Methods

-viewController:annotationsForBucketAtIndex:

Asks for all the annotations that will be placed in the bucket.

-viewController:didAddAnnotationsViews:

Notifies the delegate when SGAnnotationViews have been added to the SGARView .

-viewController:viewForAnnotation:atBucketIndex:

 Returns a view to be used in the arView .

-viewControllerNumberOfBuckets:

The number of buckets to create.


viewController:annotationsForBucketAtIndex:


Asks for all the annotations that will be placed in the bucket.

- (NSArray*) viewController:(SGARNavigationViewController*)nvc 
        annotationsForBucketAtIndex:(NSInteger)bucketIndex; 
Parameters
nvc

The SGARNavigationViewController that needs a bucket to be filled.

bucketIndex

The index of the bucket to be filled.

Return Value

 An array of SGRecordAnnotations that will be placed in the bucket.


viewController:didAddAnnotationsViews:


Notifies the delegate when SGAnnotationViews have been added to the SGARView.

- (void) viewController:(SGARNavigationViewController*)nvc 
        didAddAnnotationsViews:(NSArray*)annotationViews; 
Parameters
nvc

The SGARNavigationViewController that has added the views to the arView .

annotationViews

The annotation views that were added.


viewController:viewForAnnotation:atBucketIndex:


 Returns a view to be used in the arView.

- (SGAnnotationView*) viewController:(SGARNavigationViewController*)nvc viewForAnnotation:(id<MKAnnotation>)annotation atBucketIndex:(NSInteger)bucketIndex; 
Parameters
nvc

The SGARNavigationViewController that requires a new view.

annotation

The SGAnnotation that needs a view.

bucketIndex

The index of the bucket that is currently being loaded into the AR view.

Return Value

 The SGAnnotationView to be used with the SGRecordAnnotation. If nil is returned, then no annotation view will be displayed for the annotation.

Discussion

 Since SGAnnotationViews are reusable, you can access the arView and call dequeuereusableAnnotationView in the same manner you would a UITableViewCell. Like the UITableViewCell, it is recommended to resuse views.

When creating your SGAnnotationViews, it is not required to set the annotation property. The arView will assign the passed in annotation to the view if the view does not come assigned with an annotation.


viewControllerNumberOfBuckets:


The number of buckets to create.

- (NSInteger) viewControllerNumberOfBuckets:(SGARNavigationViewController*)nvc; 
Parameters
nvc

The SGARNavigationViewController that is asking for the amount of buckets.

Return Value

The number of buckets the to create.

© SimpleGeo Last Updated: 03/31/2010