我正在尝试在我的应用程序中显示UIActionsheet.它在纵向模式下完美运行,但当我尝试以横向方向显示时,它仍然从底部滑入.但是它不再使用带有拾取器控件的按钮和显示器,就像在横向模式下一样.它处于错误的位置.
我不使用自动旋转并将所有内容保持在纵向模式.偶尔我会以横向模式显示内容,并希望动作表正确显示.
我正在设置状态栏方向......
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeLeft animated:NO];
Run Code Online (Sandbox Code Playgroud)
当我处于"横向模式"时,状态栏始终显示正确.如果我显示AlertView,它也会正确显示.然后我会像这样显示动作表
UIActionSheet *as = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:@"Cancel Button" destructiveButtonTitle:nil otherButtonTitles: @"button", nil];
as.actionSheetStyle = UIActionSheetStyleBlackOpaque;
[as showInView:self.view];
//[as showFromToolbar:toolbar];
Run Code Online (Sandbox Code Playgroud)
我还试图从应用程序委托和工具栏中显示它.如果我在显示之前设置状态栏方向仍然不起作用.我甚至试过了.
[[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeLeft];
Run Code Online (Sandbox Code Playgroud)
有没有人知道为什么动作表可能显示在错误的位置但是有正确的控件?或者如何强制动作表显示在特定位置.我宁愿不必实现我自己的动作表版本来让它显示正确.
提前致谢.
编辑/解决方案:强制操作表以横向模式显示
以下是我如何设法让它工作,我创建了一个横向视图并将其添加到我的主窗口,如下所示:
landscapeView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 480, 480)];
landscapeView.transform = CGAffineTransformMakeRotation((-1)*M_PI/2);
landscapeView.bounds = CGRectMake(0, 0, 480, 380);
[appDelegate.window addSubview:landscapeView];
Run Code Online (Sandbox Code Playgroud)
然后像这样显示我的行动表
if (landscape) {
[menu showInView:landscapeView];
} else {
[menu showInView:self.view];
}
Run Code Online (Sandbox Code Playgroud)
非常感谢tc.在这里指出我正确的方向.
有谁知道我在哪里可以找到一个iphone应用程序网站的模板,其中iphone被用作视频框架并且在景观中?我找到一个很难找.谢谢!
旋转到横向时,我的导航控制器的导航栏不会改变高度.

我觉得它保持在44像素而不是34像素.
我该怎么做才能解决这个问题?
我将UITabBarController子类化为了覆盖,shouldAutorotateToInterfaceOrientation:以便在某些情况下我可以支持横向模式.当我运行它时,标签栏控制器在重写方法返回时给我以下消息NO
The view controller <...0x644f50> returned NO from -shouldAutorotateToInterfaceOrientation: for all interface orientations. It should support at least one orientation.
如何回报比让其他消息的乘坐任何建议YES在所有的时间shouldAutorotateToInterfaceOrientation?
我正在创建一个仅支持LANDSDCAPE模式的iPad应用程序.我正在使用故事板.
即使在执行以下操作后,当模拟器以横向模式启动时,应用程序也仅以纵向模式启动.请帮助我如何使应用程序以横向模式启动并始终保持该模式.
在此先感谢您的帮助.我在网上搜索过但是没有答案.
我正在使用用xml设计的视频视图.此视频在纵向模式下全屏显示,但当它转为横向模式时,它会保持对齐状态,宽度和高度都会被包裹而不是全屏.
我提到了这些,但仍然没有解决方案.
任何人都知道答案吗?
更新:这是我的xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<VideoView android:id="@+id/youtubewebView"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:layout_alignParentLeft="true" android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true" android:layout_gravity="fill" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
更新2:
public class VideoStreamingActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final VideoView videoView = (VideoView)findViewById(R.id.your_video_view);
String videoUrl = "http://www.pocketjourney.com/downloads/pj/video/famous.3gp";
try {
Uri uri = Uri.parse(videoUrl);
videoView.setVideoURI(uri);
videoView.setMediaController(new MediaController(this));
videoView.requestFocus();
//videoView.start();
videoView.setOnErrorListener(new OnErrorListener() {
@Override
public boolean onError(MediaPlayer arg0, int arg1, int …Run Code Online (Sandbox Code Playgroud) 我们有什么方法可以在导航时强制将应用方向从纵向更改为横向?
我要求将控制器从A推到B.B应该是横向的,但我的A控制器是纵向的.
iphone landscape objective-c orientation uinavigationcontroller
我非常喜欢这个网站因为我能找到许多有用的解决方案对我非常有帮助,特别是我是android编程的初学者,这是我的第一个问题所以我希望能从这个伟大的社区找到帮助.
问题:我在我的应用程序中播放视频,并在用户定位屏幕时以横向全屏播放,因此我想通过使用seekTo()和getCurrentPosition()从同一点播放视频 - 但视频播放的问题在位置后的许多秒我的意思是视频寻找到相同的时间点,但是当开始播放时它增加了许多秒.
我的代码:
//initialise everything
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
v = (VideoView) findViewById(R.id.videoView1);
v.setVideoPath(dir + videoName + ".3gp");
v.setMediaController(new MediaController(this));
if (savedInstanceState == null){
v.start();
}
else {
playingTime = savedInstanceState.getInt("restartTime", 0);
v.seekTo(playingTime);
}
}
@Override
protected void onSaveInstanceState(Bundle outState) {
// TODO Auto-generated method stub
super.onSaveInstanceState(outState);
if (file.exists()){
playingTime = v.getCurrentPosition();
v.stopPlayback();
outState.putInt("restartTime", playingTime);
}
}
Run Code Online (Sandbox Code Playgroud)
我尝试了很多解决方案,比如这个 如何在转换到横向模式android时继续播放视频
我正在使用Galaxy Nexus测试我的应用程序..我会感激任何提示.抱歉我的英语不好,非常感谢.
我正在开发一个iPad应用程序,当用户通过登录表单进行身份验证时,它将以模态方式加载UIWebView中的网页.这很好用,但是当我将设备旋转到横向模式时,webview只覆盖屏幕的75%:

这是我的登录视图控制器的代码:
// Load storyboard for easy instatiation of the login view controller
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPad" bundle:nil];
WebViewController *webController =
(WebViewController *)[storyboard instantiateViewControllerWithIdentifier:@"WebView"];
// Present the embedded browser in fullscreen.
[webController setModalPresentationStyle:UIModalPresentationFullScreen];
[self presentViewController:webController animated:YES completion: nil];
Run Code Online (Sandbox Code Playgroud) 我正在编写一个在横向模式下运行的android应用程序.当我将设备旋转180度时,它保持原样.我能做什么?改变以及它可以在两个水平方向上运行的位置?
landscape ×10
iphone ×5
android ×3
ios ×2
ipad ×2
orientation ×2
eclipse ×1
objective-c ×1
storyboard ×1
templates ×1
uiwebview ×1
web ×1
xml ×1