标签: landscape

当deviceOrientation改变时,在UITableView中重新加载数据

我正在使用带有UITableViewCell的UITableView.我的应用程序支持横向,所以我创建了2个UITableViewCell:一个用于portraid,另一个用于横向.

在我的cellForRowAtIndexPath方法中,这是我的代码

static NSString *CellIdentifier;
static NSString *NibNamed;

UIDeviceOrientation deviceOrientation = [UIApplication sharedApplication].statusBarOrientation;

if (deviceOrientation != UIDeviceOrientationLandscapeLeft &&
    deviceOrientation != UIDeviceOrientationLandscapeRight)
{
    CellIdentifier= @"Cell1";
    NibNamed = @"cell_news";
}
else
{
    CellIdentifier= @"Cell2";
    NibNamed = @"cell_news_landscape";
}

[[NSBundle mainBundle] loadNibNamed:NibNamed owner:self options:NULL];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];


if (cell == nil)
{
    NSArray *nib = [[NSBundle mainBundle] loadNibNamed:NibNamed owner:self options:nil];
    cell = [nib objectAtIndex:0];
}
///here i add title, description, ecc... in my UITableViewCell
Run Code Online (Sandbox Code Playgroud)

然后在shouldAutorotateToInterfaceOrientation我写了这个:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
[my_table reloadData];
return …
Run Code Online (Sandbox Code Playgroud)

iphone landscape uitableview

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

带有3个按钮的UIAlertView以横向模式隐藏消息

我的UIAlertView有一条消息和3个按钮,我的问题是通常以纵向显示警报视图,但它以横向模式隐藏消息,如下面的屏幕截图所示.如何显示消息?提前致谢.

人像模式 景观

message landscape hide uialertview

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

在PHP中创建两个相等高度的随机纵向和横向图像列

鉴于随机数量的纵向和横向图像,我正在尝试编写PHP代码以输出两列高度相等的列:

  • 通过将值"1"分配给风景图像并将"2"分配给人像,我的想法是将总图像($ totalphotos)除以2,然后检查图像值($ photoval)是否超过该数字因为它遍历循环.
  • 例如,如果您有6个总图像,并且第一列已经有2个风景图像,而第三个图像它是一个肖像,它将重新排序数组(array_splice)并将肖像图像向下移动然后继续下一个图片.
  • 如果输出已创建两个相等高度的列(例如第一列中的3个横向和第二列中的1个横向+ 1个纵向,则删除最后一个图像)

我不确定我的方法在循环期间尝试输出html是否正确,或者是否更有意义分析数组并首先重新排序图像然后创建第二个循环以输出html.

我的代码有点脏,我的"array_splice"方法可能甚至不完全正确.如果您看到更好的方法,请随意废弃我的代码并向我展示更好的内容!任何帮助是极大的赞赏!!

<?php

     $photoval = 0;
     $totalcolumns = 0;
     $totalphotos = count($photos);

     for ($counter = 0; $counter < $totalphotos; $counter++) :

            $photo = $photos[$counter];

            if ($photoval == 0) echo "        <div class=\"column\">\n";

            if ($photo['orientation'] == "portrait" && $photoval >= $totalphotos/2) {
            if ($counter == $totalphotos)
                    echo "        </div>\n";                
                    array_splice($photos, $counter, 1, array($photo));

                    continue;
            }
?>
     <div class="<? echo $photo['orientation'] ?> thumbnail">
          <a href="<?php echo $photo['link'] ?>">
               <img src="<?php if ($photo['orientation'] == "landscape") echo …
Run Code Online (Sandbox Code Playgroud)

php landscape portrait image

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

在iphone上加载时,Phonegap/Cordova将启动图像旋转90度

我一直在制作一款iOS应用程序,直到现在我才在iPad上进行测试,而我现在正努力让它在iPhone和iPod上运行.

我的应用程序只是横向,我在我的项目文件中设置了允许的方向,只允许在iPad和iPhone上使用横向.这在iPad上运行得很好......飞溅在风景中出现,它可以很好地应用到应用程序中.在我的iPod上,它不是那么好用.我已将所有正确的肖像图像放入Xcode中,但当它加载时(在模拟器上和我的iPod上),它会将图像旋转到装载的一半.因此,它以纵向方向开始我的肖像图像,然后在几秒钟后,它突然将图像旋转90度并将其拉伸至仍然适合屏幕.然后继续加载横向应用程序.无论我尝试什么,它都会继续这样做......任何人都可以对这种情况有所了解吗?我想要它做的是加载启动图像,然后淡入应用程序.

图像显示发生了什么:

http://jamesmcilveen.com/images/1.jpg http://jamesmcilveen.com/images/2.jpg

我已经尝试在所有不同的viewControllers中设置shouldAutorotateToInterfaceOrientation只返回yes,如果支持方向和类似的东西,但它仍然不起作用..

我甚至在新安装的Cordova中重新启动了我的项目,我仍然遇到了同样的问题.在使用默认的Cordova启动图像进行新的未更改安装时,我甚至遇到了问题.

我用谷歌搜索了几个小时,并且惊讶于没有其他人遇到过和我一样的问题?

哦,我顺便使用Cordova 2.7.0,忘记提及.

iphone landscape splash-screen rotation cordova

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

iPad环境中的额外机身高度,没有正文内容(iOS7)

问题:
在横向模式下在iOS7 iPad上加载上面的URL时,会有一个垂直滚动条.有没有身体的内容,它的标准化身体/ HTML保证金/填充.要明确这是我可以提供的最小测试用例,因此缺少内容和空白页面.

演示:http :
//fiddle.jshell.net/AKRCa/show/

我尝试过的事情:
将视口设置为:

<meta name="viewport" content="width=device-width, initial-scale=1.0">
Run Code Online (Sandbox Code Playgroud)

<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">`
Run Code Online (Sandbox Code Playgroud)

其他一些信息:
我无法访问运行iOS6的iPad,但我使用browserstack在运行iOS6的iPad3上测试了该演示,并且没有滚动条,所以看起来这个bug仅限于iOS7.

iPhone肖像也没有滚动条,但iPhone风景确实如此.

css landscape ipad ios7

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

如何在Swift中检测并应用横向方向到AVCaptureVideoPreviewLayer?

我基本上是在回答这个问题AVCaptureVideoPreviewLayer方向 -除了在Swift中需要景观.

我的目标是iOS 8,而AVCaptureVideoPreviewLayer似乎没有setVideoOrientation功能.

我应该如何检测方向已更改,并正确旋转AVCaptureVideoPreviewLayer?

landscape orientation swift ios8

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

仅为横向模式设置视口

我正在完成我的网站,除了一件小事外,一切都完美无缺。当我使用我的 iPhone 时,纵向模式正是我想要的,问题是横向模式。我好像已经设计过了,但我不喜欢最终版本...所以我需要插入另一行代码,但我不知道该怎么做...

这是我拥有的现在

<meta name="viewport" content="width=device-width,initial-scale=1">

现在我需要一个只为风景模式。我希望这个 ^ 一直工作,除了横向模式。在横向模式下,我想要这个:

<meta name="viewport" content="height=device-height,initial-scale=1">

我的问题是我怎么说这只能在横向模式下工作?

谢谢

html mobile landscape viewport responsive-design

5
推荐指数
0
解决办法
8581
查看次数

相机只能在人像模式下快速拍照

如何将相机设置为横向模式?每次我拍照时,图像都会保存为人像图像。当设备处于横向模式时,照片看起来不错,但如果我在相机胶卷中看到它,它仍然是纵向模式。这是我的拍照功能:

// take a photo
@IBAction func takePhoto(sender: AnyObject) {
self.fullScreenView.hidden = false
self.recordButton.enabled = false
self.takephoto.enabled = false
self.recordButton.hidden = true
self.takephoto.hidden = true

session.startRunning()

// customize the quality level or bitrate of the output photo
session.sessionPreset = AVCaptureSessionPresetPhoto

// add the AVCaptureVideoPreviewLayer to the view and set the view in fullscreen
fullScreenView.frame = view.bounds
videoPreviewLayer.frame = fullScreenView.bounds
fullScreenView.layer.addSublayer(videoPreviewLayer)

// add action to fullScreenView
gestureFullScreenView = UITapGestureRecognizer(target: self, action: #selector(ViewController.takePhoto(_:)))
self.fullScreenView.addGestureRecognizer(gestureFullScreenView)

// add action to myView
gestureView = UITapGestureRecognizer(target: …
Run Code Online (Sandbox Code Playgroud)

camera landscape portrait ios swift

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

iOS上单一页面的Flutter设备方向

我想以横向模式在Flutter应用程序中显示单个页面。其他所有屏幕均应以纵向模式显示。

我找到了以下代码片段:

在我的main.dart中

SystemChrome.setPreferredOrientations([
    DeviceOrientation.portraitUp,
    DeviceOrientation.portraitDown,
  ]).then((_) {
    runApp(new IHGApp());
  });
Run Code Online (Sandbox Code Playgroud)

这将以纵向模式启动该应用程序。所以我有要在横向模式下显示的屏幕,这是我在那里使用的代码:

@override
  void initState() {
    super.initState();
    SystemChrome.setPreferredOrientations([
      DeviceOrientation.landscapeRight,
      DeviceOrientation.landscapeLeft,
    ]);
  }


  @override
  void dispose() {
    SystemChrome.setPreferredOrientations([
      DeviceOrientation.portraitUp,
      DeviceOrientation.portraitDown,
    ]);
    super.dispose();
  }
Run Code Online (Sandbox Code Playgroud)

这适用于Android。

在iOS上,似乎无法对单个页面强制使用横向模式。

https://github.com/flutter/flutter/issues/13238

在本文中,我找到了此问题的问题。鲁rod的提到了如何解决这个问题。

“我解决了创建一个小型平台通道的问题,该通道调用此代码以在调用setPreferredOrientations之前立即切换到肖像:”

[[UIDevice currentDevice] setValue:@(UIInterfaceOrientationPortrait) forKey:@"orientation"];
Run Code Online (Sandbox Code Playgroud)

和对应的代码切换到风景

[[UIDevice currentDevice] setValue:@(UIInterfaceOrientationLandscapeLeft) forKey:@"orientation"];
Run Code Online (Sandbox Code Playgroud)

如何在我的应用程序中实现呢?

landscape ios landscape-portrait flutter

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

如何在Java中生成森林

我正在创建一个可以完美生成景观的游戏,一个星期前,我已经创建了一个基本的“森林”生成系统,只是一个for循环需要一个大块,并将随机数量的树木放置在随机位置。但这并不能给我带来希望的结果。

for(int t = 0; t <= randomForTrees.nextInt(maxTreesPerChunk); t++){

    // generates random locations for the X, Z positions\\
    // the Y position is the height on the terrain gain with the X, Z coordinates \\
    float TreeX = random.nextInt((int) (Settings.TERRAIN_VERTEX_COUNT + Settings.TERRAIN_SIZE)) + terrain.getX();
    float TreeZ = random.nextInt((int) (Settings.TERRAIN_VERTEX_COUNT + Settings.TERRAIN_SIZE)) + terrain.getZ();
    float TreeY = terrain.getTerrainHeightAtSpot(TreeX, TreeZ);

    // creates a tree entity with the previous generated positions \\
    Entity tree = new Entity(TreeStaticModel, new Vector3f(TreeX, TreeY, TreeZ), 0, …
Run Code Online (Sandbox Code Playgroud)

java opengl landscape lwjgl

5
推荐指数
0
解决办法
143
查看次数