Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 如何将图形旋转或调整为横向?_Iphone_Core Plot_Landscape - Fatal编程技术网

Iphone 如何将图形旋转或调整为横向?

Iphone 如何将图形旋转或调整为横向?,iphone,core-plot,landscape,Iphone,Core Plot,Landscape,我敲了将近半天的脑袋,但仍然无法找到解决办法。如果这是个蹩脚的问题请原谅 目标:始终以横向模式显示我的图形,无论设备的方向如何。我希望我的x轴和y轴显示如图所示。x轴比y轴占用更多的空间来显示更多的数据,这有多好,但没有提到作者是如何做到这一点的 我现在的正常运行时间是: -(BOOL)应自动旋转指针面定向:(UIInterfaceOrientation)interfaceOrientation { 返回YES; } 同样在viewDidLoad中,我尝试将我的视图旋转90度: self.vi

我敲了将近半天的脑袋,但仍然无法找到解决办法。如果这是个蹩脚的问题请原谅

目标:始终以横向模式显示我的图形,无论设备的方向如何。我希望我的x轴和y轴显示如图所示。x轴比y轴占用更多的空间来显示更多的数据,这有多好,但没有提到作者是如何做到这一点的

我现在的正常运行时间是:

-(BOOL)应自动旋转指针面定向:(UIInterfaceOrientation)interfaceOrientation
{
返回YES;
}
同样在
viewDidLoad
中,我尝试将我的视图旋转90度:

self.view.transform=CGAffineTransformMakeRotation(-M_PI*(90)/180.0));
在加载时,我的视图如下所示,
Date
是x轴,
carries Burned
是y轴

当我旋转模拟器时,它看起来很奇怪:

有人能告诉我怎么调整这个东西吗?非常感谢


*收到正确答案后编辑:
我还要提到的一件事是,要解决我在图2中提到的问题,只需写下:

myHostingGraph.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);

这是一条非常重要的路线,可以使定向工作更加完美。引用自:

为什么不将整个UIViewController设置为仅具有以下内容的横向视图:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
   if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
              return (interfaceOrientation != UIInterfaceOrientationPortrait && interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
   }
    else return YES;
}

如果你真的愿意,当他们把它变成纵向时,只需变换/旋转标签,然后用,
ibuilabel*yourlab
yourLabel.center=CGPointMake(yourGraph.center.x,10)

为什么不将整个UIViewController设置为仅具有以下内容的横向视图:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
   if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
              return (interfaceOrientation != UIInterfaceOrientationPortrait && interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
   }
    else return YES;
}

如果你真的愿意,当他们把它变成纵向时,只需变换/旋转标签,然后用,
ibuilabel*yourlab
yourLabel.center=CGPointMake(yourGraph.center.x,10)

我想提到的另一件事是,要解决我在图2中提到的问题,只需编写:
myHostingGraph.autoresizingMask=(uiviewsautoresizingflexiblewidth | uiviewsautoresizingflexiblewhight)。这是一条非常重要的路线,可以使定向工作更加完美。引用自:我想提到的另一件事是,要解决我在图2中提到的问题,只需编写:
myHostingGraph.autoresizingMask=(uiviewsautoresizingflexiblewidth | uiviewsautoresizingflexiblewhight)。这是一条非常重要的路线,可以使定向工作更加完美。参考资料来源: