标签: landscape-portrait

IOS 如何让 MPMediaPickerController 只在横向模式下出来?

由于某些原因,我限制我的应用程序只能在横向模式下工作,但奇怪的是,当我从我的应用程序打开 iPod 音乐库时,它总是会以纵向模式跳出。

看到下面的代码,我很困惑是否是系统默认行为?我怎样才能让它以横向模式出现(与其他 UI 保持一致)?谢谢。

- (IBAction)getMusic:(id)sender {
    MPMediaPickerController *picker = [[MPMediaPickerController alloc] initWithMediaTypes: MPMediaTypeMusic];
    picker.delegate                     = self;
    picker.allowsPickingMultipleItems   = YES;
    picker.prompt                       = NSLocalizedString (@"Add songs to play",nil);

    [self presentModalViewController: picker animated: NO];
    [picker release];
}


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

    }
}
Run Code Online (Sandbox Code Playgroud)

ios landscape-portrait

2
推荐指数
1
解决办法
1226
查看次数

自定义横向/纵向视图

我希望我的按钮按照我的纵向视图和我的横向视图的不同方式排列.我还希望能够在我的横向视图中添加可能现在在我的纵向视图中的内容.我知道这是可能的原因显然是每个iphone附带的计算器应用程序.当您将其侧向倾斜到横向时,它会为您提供一组全新的按钮.有没有人知道如何创建一个自定义纵向视图,当iphone正面朝上时加载,以及当iphone侧面有不同按钮时如何创建自定义横向视图?

iphone user-interface view ios landscape-portrait

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

在配置更改时锁定屏幕纵向

我有一个布尔的简单活动.我希望它从纵向更改为横向,当且仅当该布尔值为假时(当然,仅当屏幕改变方向时).

我试过这个:

    @Override
    public void onConfigurationChanged(final Configuration newConfig) {
        super.onConfigurationChanged((listening) ? getListeningConfiguration(newConfig)
                : newConfig);
        setContentView(R.layout.medidor);
        preconfigureLayout();
    }

    public Configuration getListeningConfiguration(final Configuration c) {
        c.orientation = Configuration.ORIENTATION_PORTRAIT;
        return c;
    }
Run Code Online (Sandbox Code Playgroud)

但它根本行不通.

除非我告诉它可以改变,否则如何强制活动保持纵向状态?

android landscape-portrait

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

使用NSNotificationCenter和UIDeviceOrientation更改方向

当我在xCode中更改模拟器的方向时,为什么不工作?我看到ViewController上的标签始终等于并且NSLog没有出现.

ViewController.m:

- (void)viewDidLoad
{
    [self orientacionActual];
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(orientacionActual)
                                                 name:UIDeviceOrientationDidChangeNotification
                                               object:nil];

}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(UIDeviceOrientation) orientacionActual
{
    UIDeviceOrientation orientacionActual = [UIDevice currentDevice].orientation;
    return orientacionActual;
}

- (void) cambiaOrientacion:(NSNotification *) notificación
{
    if(UIDeviceOrientationIsLandscape([self orientacionActual]))
    {
        self.LabelEstoy.text = @"Landscape";
        NSLog(@"Landscape");
    } else if (UIDeviceOrientationIsPortrait([self orientacionActual]))
    {
        self.LabelEstoy.text = @"Portrait";
        NSLog(@"Portrait");
    }
}
Run Code Online (Sandbox Code Playgroud)

orientation nsnotificationcenter ios landscape-portrait

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

横向布局在方向更改时不会更改,并且portain布局在方向更改时不会更改

我有两个布局,其中一个是肖像,一个是横向,横向位于layout-land文件夹中,肖像位于布局文件夹中,两者都具有相同的名称.我想在这里做的是,当模拟器屏幕是纵向时,它将加载肖像,当屏幕是横向时,它将加载横向布局但当第一个视图是纵向时不会发生,当我改变方向时它仍会加载在横向视图中的纵向布局,当它的风景第一,我将方向更改为纵向时,它会在纵向屏幕上加载横向布局,这似乎是问题所在.

肖像代码:http://pastebin.com/QSVL2MHf
横向代码:http://pastebin.com/ktGAe0QX

android android-layout landscape-portrait

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

Exoplayer 旋转到横向时的方向问题

当视频在 Exoplayer 中播放时效果很好,但当它旋转时,视频会再次开始。我想确保当视频旋转时视频恢复到相同的位置我已经保存了玩家的当前位置但仍然不起作用。请帮忙.....

public class RecipeStepDescriptionFragment extends Fragment {


    @BindView(R.id.playerView)
    PlayerView playerView;

    @BindView(R.id.stepDescription)
    TextView stepDescription;

    @BindView(R.id.ingredientsCardSteps)
    CardView ingredientsCardSteps;

    @BindView(R.id.ingredientsListStepDescription)
    TextView ingredientsListStepDescription;


    @BindView(R.id.widgetButtonStepDescription)
    FloatingActionButton widgetButton;


    private SimpleExoPlayer player;

    private static final String TAG = "StepDetail";


    String videoUrl;
    String longDescription;
    boolean tablet;
    String ingredients;
    String name;

    public RecipeStepDescriptionFragment() {
        // Required empty public constructor
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View rootView = inflater.inflate(R.layout.fragment_recipe_step_description, container, false);
        ButterKnife.bind(this, rootView);





        if (getArguments() …
Run Code Online (Sandbox Code Playgroud)

android savestate orientation landscape-portrait exoplayer

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

如何在本机反应中以横向模式打开图像

我的整个应用程序处于纵向模式,但是当我双击图像/缩略图时,我希望图片以横向方式打开,并在 React Native 中关闭图像时自动返回纵向。如果已经发布,我真的很感激对此的一些帮助或对类似解决方案的参考。

android ios landscape-portrait reactjs react-native

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

如何强制视图控制器保持纵向模式?

我有一个带故事板的iOS应用程序.我希望我的上一个viewcontroller始终处于纵向模式.我一直在读书,从那以后我发现了

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
Run Code Online (Sandbox Code Playgroud)

不推荐使用我应该使用其他方法

-(BOOL)shouldAutorotate  
-(NSInteger)supportedInterfaceOrientations
-(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
Run Code Online (Sandbox Code Playgroud)

但我已经尝试了很多这种方法的组合,我无法做到这一点.所以请有人能告诉我正确的方法吗?

xcode rotation screen-orientation ios landscape-portrait

0
推荐指数
1
解决办法
2304
查看次数

使用UITabBarController和/或UINavigationController时,仅限某些视图控制器到特定方向

我在网上搜索得很高,但是找不到明确的答案.UIViewController当嵌入在a中时UINavigationController,只有一种支持横向模式的最佳方法是UITabBarController什么?

像这样的大多数解决方案都建议压倒一切

-(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
Run Code Online (Sandbox Code Playgroud)

AppDelegate.这有点工作,但是当从唯一ViewController支持横向模式返回时,所有其他(非横向ViewControllers)也将处于横向方向.他们没有保持纵向.

我已经看到应用程序正确,所以我知道它必须以某种方式.例如,电影播放器​​应用程序通常仅限于肖像,但实际的电影播放器​​视图以强制横向模式模式呈现.在解除模态视图控制器后,底层视图控制器仍然正确纵向,

任何提示?

objective-c uiviewcontroller uiinterfaceorientation ios landscape-portrait

0
推荐指数
1
解决办法
498
查看次数

android:configChanges="orientation|screenSize" 改变我的布局外观

我有一个Adapter班级和一个MainActivity. 班级Adapter显示孩子们的姓名列表,在姓名旁边,还显示time他们到达学校的时间。问题是当我旋转到横向时,这些time值会丢失。

我考虑在我的清单中添加MainActivity

android:configChanges="orientation|keyboardHidden|screenSize"
Run Code Online (Sandbox Code Playgroud)

发生的情况是,时间值在横向模式下不会丢失,但布局的外观与纵向模式相同。实际上,横向布局看起来与纵向布局有点不同。

在这种情况下我该怎么做才能获得time值并保持景观布局的外观。

android landscape-portrait

0
推荐指数
1
解决办法
2759
查看次数