Мне уже удавалось сделать это в прошлом, когда вы открываете определенный вид, и симулятор поворачивается влево, а затем возвращается к портрету.
Я могу сделать вид ландшафта, но мне нужно повернуть голову, чтобы увидеть его.
Я пробую Мориатрийский пирог .
Вот код, который я использую в viewWillAppear
CGRect myImageRect = CGRectMake(0.0f, 20.0f, 460.0f, 280.0f);
BNPieChart* chart = [[BNPieChart alloc] initWithFrame:myImageRect];
[chart addSlicePortion:0.1 withName:@"Orange 10%"];
[chart addSlicePortion:0.2 withName:@"Fandango 10%"];
[chart addSlicePortion:0.1 withName:@"Blue 10%"];
[chart addSlicePortion:0.1 withName:@"Cerulean 10%"];
[chart addSlicePortion:0.3 withName:@"Green 10%"];
[chart addSlicePortion:0.1 withName:@"Yellow 10%"];
[chart addSlicePortion:0.1 withName:@"Pink 10%"];
[self.view addSubview:chart];
Это то, что я пробовал .... Возможно, я не использовал их правильно ???
PieChartViewController *nextController = [[[PieChartViewController alloc]
initWithNibName:@"PieChartView" bundle:nil] autorelease];
AppDelegate *delegate = (AppDelegate *)[[UIApplication sharedApplication]
delegate];
CGAffineTransform newTransform =
CGAffineTransformMake(0.0,1.0,-1.0,0.0,0.0,0.0);
nextController.view.transform = newTransform;
[nextController setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
[delegate.graphNavController pushViewController:nextController animated:YES];
А это ..
- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)
interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft ||
interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
И ...
- (void)viewDidLoad {
[super viewDidLoad];
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(didRotate:)
name:@"UIDeviceOrientationDidChangeNotification"
object:nil];
}
- (void) didRotate:(NSNotification *)notification {
UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
if (orientation == UIDeviceOrientationLandscapeLeft ||
orientation == UIDeviceOrientationLandscapeRight) {
return;
}
}