简体   繁体   English

Xcode 1)使用滑动手势开始并保持在横向模式2)点击图像时播放音频

[英]Xcode 1) Start and stay in landscape mode with swipe gesture 2) Play audio sound when image is tapped

I'm fairly new at programming and using Xcode for iPhone App design. 我在编程和使用Xcode进行iPhone App设计方面还很陌生。 I wish to do the following: 我希望执行以下操作:

  1. Start and stay in landscape mode for a children's app. 启动并停留在儿童应用程序的横向模式下。
  2. Use swipe gestures to move from image to image. 使用滑动手势在图像之间移动。 One image per swipe. 每次滑动一张图片。

My problem is this: 我的问题是这样的:

even when starting in landscape mode, and after a swipe, the iphone simulator rotates to portrait mode. 即使以横向模式启动并滑动后,iphone模拟器也会旋转至纵向模式。

Any advice or comment is greatly appreciated. 任何建议或意见,不胜感激。

You have to define in shouldAutorotateToInterfaceOrientation: which modes you support. 您必须在shouldAutorotateToInterfaceOrientation:中定义您支持的模式。

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}

will handle both landscape modes. 将处理两种风景模式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM