페이지 컬 기능이있는 mapview를 만들었습니다. 지도 뷰에는 툴바가 있고 페이지 컬 버튼이 있습니다. 버튼을 클릭하면지도보기 페이지가 말 릅니다. 여기에 코드가 있습니다.UISegmentedControl click 이벤트가 IOS 6에서 작동하지 않습니다.
-(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];
}
지도보기 페이지가 구부러 지므로 그 아래에 새로운 viewcontroller가 있습니다. 새 뷰 컨트롤러에는 세 개의 세그먼트가있는 세그먼트 컨트롤이 있습니다.
- (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];
}
나는 세그먼트 컨트롤러의 각 부분을 클릭에지도의 표준/위성/하이브리드 볼 수 있습니다.
- (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;
}
페이지 넘김 기능이 정상적으로 작동합니다. 앞에서 언급했듯이 페이지가 휘어서 새 뷰에서 분할 컨트롤이 있습니다. 그러나 세그먼트 화 된 컨트롤은 IOS 6에서 제대로 작동하지 않습니다. 디버깅하고 확인했습니다. 세그먼트를 클릭하면 컨트롤에서 이벤트 메서드를 입력하지 않습니다. 이전 버전의 IOS에서는 여전히 작동하지만 IOS 6에서는 작동하지 않습니다. 무엇이 잘못 되었나요? 도움이 필요하다.