【发布时间】:2013-02-21 07:49:01
【问题描述】:
在横向模式下创建应用程序后。我正在纵向视图中为我的应用程序添加菜单视图
但是当我尝试从 xib 和以编程方式更改视图时
视图已更改,但移动模拟器仍显示为横向视图以及显示前一个视图背景
我已经解决了很多关于方向的问题,但似乎没有什么对我有用
这是应用的图片参考
创建按钮的代码是
简单的按钮代码是
easee = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[easee addTarget:self
action:@selector(easy:)
forControlEvents:UIControlEventTouchUpInside];
[easee setImage:[UIImage imageNamed:@"radioButtonDisabled.png"] forState:UIControlStateNormal];
easee.frame = CGRectMake(85.0, 86.0, 22.0, 22.0);
[self.view addSubview:easee];
【问题讨论】:
-
请向我们展示一些与某些按钮的位置有关的代码。
-
你能发布你的自动旋转方法吗?如果您使用的是最新的 iOS,您可能需要声明掩码以进行自动旋转。
-
@Spectravideo328 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // 对于支持的方向返回 YES return (interfaceOrientation == UIInterfaceOrientationPortrait); } 定位代码
-
按钮位置是使用代码设置还是仅使用 IB 设置?
-
@Spectravideo328 :: 使用界面生成器在 .xib 中创建标签,并通过提供坐标信息在代码中动态创建按钮:
标签: ios objective-c xcode uiviewcontroller uiinterfaceorientation