Solved! Go to Solution.
@interface MainViewController : UIViewController <AGSMapViewLayerDelegate, AGSPortalDelegate> {
...
}- (void)viewDidLoad {
....
NSURL *url = [NSURL URLWithString:@"http://www.arcgis.com"];
AGSPortal *portal = [[[AGSPortal alloc] initWithURL:url credential:nil] autorelease];
portal.delegate = self;
AGSPortalQueryParams *queryParam = [AGSPortalQueryParams queryParamsWithQuery:portal.portalInfo.basemapGalleryGroupQuery];
[portal findGroupsWithQueryParams:queryParam];
}
-(IBAction)baseMapToggle:(id)sender
{
AGSPortalItem *item = [self.baseMapItems objectAtIndex:6];
AGSWebMap* webMap = [[AGSWebMap alloc] initWithPortalItem:item];
webMap.delegate = self;
}
- (void) webMapDidLoad:(AGSWebMap*) webMap {
//webmap data was retrieved successfully
[webMap openIntoMapView:self.mapView withAlternateBaseMap:[webMap baseMap] resetMapView:NO];
}[self.mapView removeMapLayerWithName:@"Base Map"]; [self.mapView insertMapLayer:self.baseMapLayer withName:@"Base Map" atIndex:0];