小编Gry*_*ack的帖子

xcode iphone模拟器视图比故事板小

我的故事板大小和iPhone模拟器上实际显示的大小有问题.有任何想法吗?

屏幕截图

iphone size xcode simulator storyboard

6
推荐指数
2
解决办法
8146
查看次数

尝试从segue返回时运行代码

我正在尝试找到一种方法来捕获从segue到根控制器的返回,这样我就可以运行自定义代码来决定下一步该做什么.我已经尝试了下面的两种方法,他们没有做到这一点,因为他们似乎(显然)关心展开segue堆栈.有什么想法吗?

-(UIStoryboardSegue *)segueForUnwindingToViewController
{
}

-(BOOL)canPerformUnwindSegueAction
{
}
Run Code Online (Sandbox Code Playgroud)

iphone viewcontroller segue

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

xcode - 如何将视图锁定为纵向模式,但仍允许一个视图旋转?

我遇到设备轮换问题.除了一个视图,我显示公司启动画面,我想将所有剩余的应用程序视图锁定到纵向显示.在项目设置中,支持的方向是Portrait和LandscapeLeft.在"公司飞溅"中它工作正常,无论我如何旋转设备,视图旋转都锁定在LandscapeLeft中.在我将设备向左旋转的所有其他视图中,视图会改变而不是保持纵向显示.这些方法甚至没有开火?如果我从项目中支持的方向中删除横向,则会拧紧"公司启动"视图.我尝试改变shouldAutorotate回归NO,但这没有帮助.试图通过这里发布的建议,但这没有帮助.如果我将以下代码放入我的AppDelegate.m,一切都被锁定为纵向模式,并且"公司启动"在访问时崩溃.

-(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
    return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown;
}
Run Code Online (Sandbox Code Playgroud)

除了一个屏幕外,无论设备如何旋转,如何将视图锁定为纵向模式?

**来自'公司飞溅'视图的方法.再次,应该是这样的工作.

-(NSInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskLandscapeLeft;
}
Run Code Online (Sandbox Code Playgroud)

**来自所有其他视图的方法,当我不希望它们旋转时,这些视图会旋转出来

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // IOS5 Only returning that it should rotate to potrait
    return (interfaceOrientation == UIDeviceOrientationPortrait);
}

-(BOOL)shouldAutorotate
{
    // forcing the rotate IOS6 Only
    return YES;
}

-(NSInteger)supportedInterfaceOrientations
{
    // return number or enum IOS6 Only
    return UIInterfaceOrientationMaskPortrait;
}
Run Code Online (Sandbox Code Playgroud)

我想也许可能是因为UITabBarController是根控制器而我在ViewController中呢?这些方法甚至没有开火?

iphone xcode portrait orientation screen-rotation

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