标签: landscape

Iphone横向模式在加载新控制器时切换到Portraite模式

我的应用程序正确地以横向模式启动并且运行良好:

- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{
    if(interfaceOrientation == UIInterfaceOrientationPortrait)
        return NO;
    if(interfaceOrientation == UIInterfaceOrientationLandscapeRight || interfaceOrientation == UIInterfaceOrientationLandscapeLeft )
        return YES; 
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
Run Code Online (Sandbox Code Playgroud)

并更新Info.plist

UIInterfaceOrientation = UIInterfaceOrientationLandscapeRight
Run Code Online (Sandbox Code Playgroud)

现在在我的主控制器中,我将一个ViewController换成另一个

characterController = [ [ CharacterController alloc ] init];
myCurrentViewController = characterController;
self.view =  myCurrentViewController.view ;
Run Code Online (Sandbox Code Playgroud)

它加载但方向处于纵向模式.如果我然后旋转了iPhone,它会将其更正为横向模式.任何想法如何在将新的viewController加载到我的mainController时保持横向方向?

iphone landscape orientation uiviewcontroller

4
推荐指数
1
解决办法
9922
查看次数

iPhone:仅在横向上,在第一个addSubview之后,UITableViewController无法正常旋转

github上提供了一个最小的说明性Xcode项目.

在我的UIWindow上,当我添加第二个(和后续的)UITableView作为子视图时,它们不能正确旋转,因此会出现在侧面.这仅在模拟器中测试.这里有一些代码给你:

- (void)applicationDidFinishLaunching:(UIApplication *)application {
    ShellTVC* viewA = [[ShellTVC alloc] initWithTitle:@"View A"];
    ShellTVC* viewB = [[ShellTVC alloc] initWithTitle:@"View B"];

    // The first subview added will rotate to landscape correctly. 
    // Any subsequent subview added will not.

    // You may try this by various commentings and rearranging of these two statements.

    [window addSubview:[viewA tableView]];
    [window addSubview:[viewB tableView]];

    [window makeKeyAndVisible];
}
Run Code Online (Sandbox Code Playgroud)

viewB出现在侧面.注释掉viewB的addSubview,viewA正确显示.仅对viewA执行此操作,并且viewB正确显示.

我不是通过NIB创建这些UITableViewControllers,尽管UIWindow是.

如果您想知道,ShellTVC是一个UITableViewController,并实现此方法:

- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
 return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
}
Run Code Online (Sandbox Code Playgroud)

另外,我已将plist文件中的UIInterfaceOrientation设置为UIInterfaceOrientationLandscapeLeft.

可能相关 - 而且没有答案 - 这里和 …

iphone landscape

4
推荐指数
1
解决办法
9995
查看次数

将MPMoviePlayerController旋转到横向 - iPhone SDK

我试图将我的MPMoviePlayerController旋转到横向视图,但它始终保持纵向模式.我在UIViewController中这样做,当我处于全屏模式时,我仍然无法旋转我的MPMoviePlayerController.我是否必须对shouldAutorotatetoOrientation方法做些什么?如果有人知道怎么做,请回复!

谢谢,

凯文

iphone landscape objective-c rotation mpmovieplayercontroller

4
推荐指数
1
解决办法
6953
查看次数

在iOS上的实际横向OpenGL视图

我正在将基于C++的引擎从Android移植到iOS,我对iOS设备上的横向模式如何工作有一些疑问.

我可以在横向模式下成功启动我的设备,但无论我如何旋转(或强制旋转),我的帧缓冲都会保持纵向模式.例如,我希望960x640分辨率而不是默认的320x480分辨率.

我一直在研究它,我看到有些人这样做但是使用OpenGL明确地旋转场景,这意味着实际的轴不是横向模式,对我来说这是一个丑陋的解决方法.

landscape screen opengl-es ios

4
推荐指数
1
解决办法
3017
查看次数

如何仅在横向模式下限制j2me应用程序

我正在使用J2ME和LWUIT开发应用程序.我想仅在横向模式下运行此应用程序.对于诺基亚,有一个属性:Nokia-MIDlet-App-Orientation:landscape,但对于其他设备,仅将应用程序限制为横向模式的属性是什么?如何为不同的J2ME设备实现这一目标?

lwuit landscape java-me screen-orientation

4
推荐指数
1
解决办法
1583
查看次数

为纵向和横向指定不同的布局?

我为一个活动指定了两个单独的布局xml文件,一个用于res/layout文件夹中的Portrait,另一个用于res/layout-land文件夹中的Landscape.我的实际问题是,当我以纵向模式启动应用程序时,它需要ui从布局和即时我旋转我的手机它不需要从布局 - 土地文件夹中的xml它需要从布局文件夹ui,如果我在横向模式下启动我的应用程序它从layout-land文件夹中获取xml并立即将我旋转到肖像模式它从布局中获取xml-land ui不会更改为纵向ui.

可以任何伙伴告诉我什么是问题是有什么需要的PLZ帮助我解决这个问题.

提前致谢 .

    this is my landscape ui xml

        <?xml version="1.0" encoding="utf-8"?>
    <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/widget57"
        android:layout_width="400dp"
        android:layout_height="400dp"
        android:layout_gravity="center|center_vertical"
        android:layout_marginTop="30dp"
        android:orientation="vertical" >

        <TableRow
            android:id="@+id/tableRow1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="40dp" >

            <TextView
                android:id="@+id/txtName"
                android:layout_width="90dp"
                android:text="@string/UserName" />

            <EditText
                android:id="@+id/edName"
                android:imeOptions="actionNext|actionDone"
                android:paddingRight="10dp"
                android:singleLine="true"
                android:width="240dp" />
        </TableRow>

        <TableRow
            android:id="@+id/tableRow2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >

            <TextView
                android:id="@+id/txtPass"
                android:layout_width="90dp"
                android:text="@string/PassWord" />

            <EditText
                android:id="@+id/edPass"
                android:imeOptions="actionGo"
                android:paddingRight="10dp"
                android:password="true"
                android:singleLine="true"
                android:width="240dp" />
        </TableRow>

         <LinearLayout
            android:id="@+id/widget57"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_gravity="center"
            android:orientation="vertical" >

            <Button
                android:id="@+id/btnLogin"
                android:layout_width="150dp"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal"
                android:layout_marginTop="10dp"
                android:text="@string/btn_GO"
                android:textSize="19sp" >
            </Button> …
Run Code Online (Sandbox Code Playgroud)

android landscape portrait screen-orientation

4
推荐指数
1
解决办法
1万
查看次数

如何在横向模式下获得主UIView的宽度?

当我使用这段代码时:

- (void)viewDidLoad
{
    [super viewDidLoad];
    CGFloat mainViewWidth = self.view.bounds.size.width;
    NSLog(@"%f", mainViewWidth);
}
Run Code Online (Sandbox Code Playgroud)

我在模拟器中得到了结果:480

当我在iPhone 4上启动应用程序时,我得到了结果320?

我做错什么了吗?

landscape uiviewcontroller uiview ios

4
推荐指数
1
解决办法
8653
查看次数

3个媒体查询iphone肖像,风景和ipad肖像

我尝试了不同的width&组合,device-width但是在横向上这个代码永远不会把背景变成红色;

当我有多个媒体查询时,我遇到了问题.看到这个JSfiddle示例,除非删除最后一个媒体查询,否则div背景永远不会是绿色

这就是我想要的3个不同媒体查询的目标:

  1. 智能手机和平板电脑(仅限肖像).这将是我拥有响应式布局的所有通用样式的地方
  2. 宽度:320px - 479px - 这将适用于小屏幕,例如仅限肖像的iphone
  3. 宽度:480px - 640px - 这将适用于较大的屏幕,如横向的iphone和纵向的ipad.不是风景中的ipad.

请注意,这是针对HTML电子邮件的,因此无法使用JS.

@media only screen and (max-width: 640px) {
    body { padding: 10px !important }
}
/* Small screen */
@media only screen and (min-device-width: 320px) and (max-device-width: 479px) {
    body { background: blue !important }
}
/* iPhone landscape and iPad portrait */
@media only screen and (max-device-width: 480px) and (max-device-width: 640px) {
    body { 
       background: red !important 
       -webkit-text-size-adjust:none; 
    } …
Run Code Online (Sandbox Code Playgroud)

css iphone landscape portrait media-queries

4
推荐指数
1
解决办法
6万
查看次数

智能手机的媒体查询(横向)

我正在开发一个智能手机友好版本的网站,我在处理智能手机横向的媒体查询时遇到了一些问题.对于纵向方向,我使用以下媒体查询,它的工作非常好:

@media only screen and(max-width:320px){style goes here}

但是当我使用这个媒体查询横向(取自css-tricks.com)时,我为横向方向编写的样式会覆盖我为我的网站桌面版本添加的样式.

@media only screen and(min-width:321px){style goes here}

这只发生在我为横向插入样式时,当我为纵向方向指定样式时不会发生这种情况.

PS我正在iPhone 4上进行测试.

css iphone landscape stylesheet media-queries

4
推荐指数
1
解决办法
4140
查看次数

Android TimePicker在横向模式下无法很好地显示

我目前正在构建一个针对API 23的应用,其API API最低.我遇到的问题是在AlertDialog中显示TimePicker.在Nexus 5 API <= 22上启动应用程序时,在纵向模式和横向模式下显示正常.但是,在Nexus 5 API 23上启动应用程序时,横向模式无法正确显示TimePicker小部件,它仅显示其背景颜色.

api mobile android landscape timepicker

4
推荐指数
1
解决办法
2042
查看次数