Ios6 如何在iOS中制作支持纵向和横向的应用程序
我正在创建一个iOS应用程序,它应该同时支持横向和纵向。所以我在这两个方向上使用了两个视图。但现在的问题是我不知道如何将Ios6 如何在iOS中制作支持纵向和横向的应用程序,ios6,landscape-portrait,Ios6,Landscape Portrait,我正在创建一个iOS应用程序,它应该同时支持横向和纵向。所以我在这两个方向上使用了两个视图。但现在的问题是我不知道如何将IBoutlets连接到文件的所有者。我们不能将一个IBOutlet设置为两种模式吗。我还没有做过任何支持这两种模式的应用程序。请任何人告诉我如何解决这个问题 谢谢我终于按照这种方式找到了这个。我创建了2个视图,并定义了独立的IBO集合。更改方向时,我将一种模式中的值指定给另一种模式的出口值。这在(void)didRotate:(NSNotification*)通知中没有出现
IBoutlets
连接到文件的所有者。我们不能将一个IBOutlet
设置为两种模式吗。我还没有做过任何支持这两种模式的应用程序。请任何人告诉我如何解决这个问题
谢谢我终于按照这种方式找到了这个。我创建了2个视图,并定义了独立的IBO集合。更改方向时,我将一种模式中的值指定给另一种模式的出口值。这在
(void)didRotate:(NSNotification*)通知中没有出现
`
{
}
`
-(void)didRotate:(NSNotification *)notification
UIDeviceOrientation newOrientation = [[UIDevice currentDevice] orientation];
if (newOrientation != UIDeviceOrientationUnknown && newOrientation != UIDeviceOrientationFaceUp && newOrientation != UIDeviceOrientationFaceDown)
{
if (orientation != newOrientation)
{
//ORIENTATION HAS CHANGED
NSLog(@"Changed Orientation");
// Do orientation logic
if (
((newOrientation == UIDeviceOrientationLandscapeLeft || newOrientation == UIDeviceOrientationLandscapeRight)) &&
((orientation == UIDeviceOrientationPortrait || orientation == UIDeviceOrientationPortraitUpsideDown))
)
{
NSLog(@"Changed Orientation To Landscape");
self.orientationMode=@"landscape";
self.txtInsidernameLandscape.text=self.txtInsiderName.text;
self.txtCompanynameLandscape.text=self.txtCompanyName.text;
self.txtAddressLandscape.text=self.txtAddress.text;
self.txtPhoneLandscape.text=self.txtTelephone.text;
self.txtEmailLandscape.text=self.txtEmail.text;
// Clear the current view and insert the orientation specific view.
[self clearCurrentView];
[self.view insertSubview:mainLandscapeView atIndex:0];
//Copy object states between views
//SomeTextControlL.text = SomeTextControlP.text;
}
else if (
((newOrientation == UIDeviceOrientationPortrait || newOrientation == UIDeviceOrientationPortraitUpsideDown)) &&
((orientation == UIDeviceOrientationLandscapeLeft || orientation == UIDeviceOrientationLandscapeRight))
)
{
NSLog(@"Changed Orientation To Portrait");
self.orientationMode=@"portrait";
self.txtInsiderName.text=self.txtInsidernameLandscape.text;
self.txtCompanyName.text=self.txtCompanynameLandscape.text;
self.txtAddress.text=self.txtAddressLandscape.text;
self.txtPhoneLandscape.text=self.txtPhoneLandscape.text;
self.txtEmail.text=self.txtEmailLandscape.text;
// Clear the current view and insert the orientation specific view.
[self clearCurrentView];
[self.view insertSubview:mainPortraitView atIndex:0];
//Copy object states between views
//SomeTextControlP.text = SomeTextControlL.text;
}
orientation = newOrientation;
}
}