在iOS 5中,我们可以通过编程方式更改设备方向,如下所示:
[[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeRight];
Run Code Online (Sandbox Code Playgroud)
但是在iOS 6 setOrientation
中已弃用,我如何在iOS 6中以编程方式更改设备方向?
我想从pdf页面打开我的应用程序中的pdf文件,但我没有在我的应用程序中打开pdf的任何选项.
这是我的info.plist文件
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>PDF</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>CFBundleTypeIconFiles</key>
<string>Icon.png</string>
<key>LSItemContentTypes</key>
<string>com.neosofttech.pdf</string>
<key>LSHandlerRank</key>
<string>Owner</string>
</dict>
</array>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.pdf</string>
</array>
<key>UTTypeDescription</key>
<string>PDFReader File</string>
<key>UTTypeIdentifier</key>
<string>com.neosofttech.pdf</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<string>pdf</string>
</dict>
</dict>
Run Code Online (Sandbox Code Playgroud)
请告诉我这里我错在哪里,如何在我的应用程序中打开pdf文件.
我想将通知放在应用程序的标签栏中,以显示为购物清单选择的项目数.有没有办法在应用程序的标签栏中添加通知.
我想在表视图的右侧添加加号按钮,以在其他视图中添加该单元格的内容.
如何在表视图的右侧添加加号按钮.
我希望通过在应用程序中存储视频来在本地播放iphone上的视频.我能怎么做?
我想为表格视图的每个单元格设置不同的图像.我不知道怎么做 - 请帮帮我.
我想将MFMailComposeViewController的导航栏更改为黑色.
我怎么能改变.
我想在不改变iPhone应用程序中的设备方向的情况下更改应用程序的方向.我想以编程方式将我的视图从portraid模式更改为landscap模式.
并且还想知道苹果商店是否会接受这个?
谢谢
现在我从其他方面得到了解决方案,如下所示
[[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeRight];
Run Code Online (Sandbox Code Playgroud)
当你在那个时候添加这一行时会出现一个警告,为了删除这个警告,只需在你的实现文件中添加以下代码即可.
@interface UIDevice (MyPrivateNameThatAppleWouldNeverUseGoesHere)
- (void) setOrientation:(UIInterfaceOrientation)orientation;
@end
Run Code Online (Sandbox Code Playgroud)
然后在波纹管方法中,如果需要,只需编写此代码.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
Run Code Online (Sandbox Code Playgroud)
但现在想知道苹果应用商店是否接受了这个?
谢谢