1

I have created a mapview, with page curl feature in it. The mapview is having a toolbar, with a page curl button. On clicking the button, the mapview page curls. Here is the code.

-(IBAction) onPageCurl:(id)sender{

pageCurlViewController = [[MyMapViewPageCurlViewController alloc] initWithNibName:@"MyMapViewPageCurlViewController" bundle:nil];
[pageCurlViewController.navigationController.toolbar setHidden:NO];
[pageCurlViewController setModalTransitionStyle:UIModalTransitionStylePartialCurl];
[pageCurlViewController setToolbarItems:toolbarItems];
[[self navigationController] presentModalViewController:pageCurlViewController animated:YES];

[pageCurlViewController getMapView:&mapView];
[pageCurlViewController release];
}

As the mapview page curls, I have a new viewcontroller underneath it. The new view controller has a segmented control with 3 segments.

- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.

[self.navigationController.toolbar setHidden:NO];
[directionSearchSegmentedControl addTarget:self action:@selector(segmentAction:) forControlEvents:UIControlEventValueChanged];
directionSearchSegmentedControl.selectedSegmentIndex = selectedIndex;
UIBarButtonItem *directionSearchSegmentedControlButton = [[[UIBarButtonItem alloc] initWithCustomView:directionSearchSegmentedControl] autorelease];

NSArray *toolbarItems = [NSArray arrayWithObjects: navigatorButton , flexibleSpace, directionSearchSegmentedControlButton, flexibleSpace, pageCurlButton, nil];
[self setToolbarItems:toolbarItems];
[self.navigationController.toolbar setHidden:NO];


}

I have standard/satellite/hybrid view of the map on clicking each segments in the segmented controller.

- (void)segmentAction:(id)sender
{
[self dismissModalViewControllerAnimated:YES];
    if([sender selectedSegmentIndex] == 0){
        selectedIndex = 0;
        pageCurlMapView.mapType = MKMapTypeStandard;
    }
    if([sender selectedSegmentIndex] == 1){
        selectedIndex = 1;
        pageCurlMapView.mapType = MKMapTypeSatellite;
    }
    if([sender selectedSegmentIndex] == 2){
        selectedIndex = 2;
        pageCurlMapView.mapType = MKMapTypeHybrid;
    }
    if([sender selectedSegmentIndex] == 2){

    }
directionSearchSegmentedControl.momentary = YES;
selectedIndex = directionSearchSegmentedControl.selectedSegmentIndex;
}

The page curl feature is working fine. As the page curls, as mentioned before, I have a segmented control in the new view. But the the segmented control is not working properly in IOS 6. I have debugged and checked. On the click of the segments, the control doesn't enter the event method. Its still working fine in the previous versions of IOS, but not in IOS 6. Cant figure out, what is wrong. Help needed.

Xavi Valero
  • 2,047
  • 7
  • 42
  • 80

2 Answers2

0

If you look at the Xcode console when the app launches, do you see a message like this:

Applications are expected to have a root view controller at the end of application launch

If so, then your you problem could be due to changes in how the root view controller needs to be set up for iOS 6.

See here for info on how to address the problem.

Community
  • 1
  • 1
ThomasW
  • 16,981
  • 4
  • 79
  • 106
0

Sorry if this is kinda late, but I have been working on something similar in my app. Honestly, I just used a simple switch method in order to change the map type. The code is below.

- (IBAction)toggle:(id)sender {

switch ([sender selectedSegmentIndex]) {
    case 0:
    {
        [self.mapView setMapType:MKMapTypeStandard];
    }break;
    case 1:
    {
        [self.mapView setMapType:MKMapTypeHybrid];
    }break;
    case 2:
    {
        [self.mapView setMapType:MKMapTypeSatellite];
    }break;
  }

}

Now I have not tried using this with multiple view controllers so this may only work with the one view controller. I just started programming on iOS so bear with me.. I'm gonna try to add the page curl effect to my app but all I have so far is a map view and a button that when it's pushed, zooms into the users location and the user is able to change the map type..

P.S. This is a Segmented Control set as a Value Changed action named "toggle" if that helps...

Demonic Penguin
  • 249
  • 4
  • 8