小编Son*_*lin的帖子

转换为横向,然后回到肖像后,iOS界限会发生变化

当我的应用程序启动时,我视图边界的NSLog显示以下内容:

NSLog(@"My view frame: %@", NSStringFromCGRect(self.view.bounds));
My view frame: {{0, 0}, {320, 548}}
Run Code Online (Sandbox Code Playgroud)

然后我旋转模拟器并获得以下内容:

NSLog(@"My view frame: %@", NSStringFromCGRect(self.view.bounds));
My view frame: {{0, 0}, {320, 548}}
Run Code Online (Sandbox Code Playgroud)

然后当我将模拟器旋转回到portait时,我得到了这个:

NSLog(@"My view frame: %@", NSStringFromCGRect(self.view.bounds));
My view frame: {{0, 0}, {568, 300}}
Run Code Online (Sandbox Code Playgroud)

我用来调整元素的两种方法是这些,它们尚未完成,因为我目前正在为新的iphone修复它们.

-(void) resizeForLandscape
{
    newsLabel = (UILabel *)[self.view viewWithTag:50];
    weatherLabel = (UILabel *)[self.view viewWithTag:51];
    sportsLabel = (UILabel *)[self.view viewWithTag:52];
    entertainmentLabel = (UILabel *)[self.view viewWithTag:53];
    videosLabel = (UILabel *)[self.view viewWithTag:54];
    moreLabel = (UILabel *)[self.view viewWithTag:55];

    NSLog(@"resizeForLandscape called");
    webView.frame = CGRectMake(0, 31, self.view.frame.size.width, …
Run Code Online (Sandbox Code Playgroud)

objective-c uiview ios

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

prepareForSegue和delegates

我有一个有两个segues的应用程序.在其中一个segue中,当前视图控制器成为委托而另一个不成为委托.

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    if ([segue.identifier isEqualToString:@"MoreOptions"]) {
        UINavigationController *navigationController = segue.destinationViewController;
        MoreOptionsViewController *controller = (MoreOptionsViewController *)navigationController.topViewController;
        controller.delegate = self;
    } else if ([segue.identifier isEqualToString:@"FullStoryView"]) {
        SingleStoryViewController *detailViewController = segue.destinationViewController;
        detailViewController.urlObject = sender;
    }
}
Run Code Online (Sandbox Code Playgroud)

所有这一切都很好,但我想尝试更好地理解代码.我不明白的是,我必须通过从navigationController.topViewController中获取它来获取对MoreOptionsViewController的引用,而不是简单地从segue.destinationViewController获取它,就像我在第二个if条件中那样.是因为我将当前视图控制器(self)设置为委托吗?同样,我不是试图解决问题,而是试图更好地了解正在发生的事情.

delegates ios segue

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

导航栏背景图像的iOS规范/指南是什么?

有谁知道导航栏背景的iOS图像分辨率?我已经在Apple的自定义图标和图像创建指南页面上找到了几乎所有其他元素的分辨率,但我似乎无法找到导航条背景图像(常规和视网膜)的像素大小要求.

user-interface xcode image ios

4
推荐指数
1
解决办法
4751
查看次数

React-Native 无法构建 ios:(错误 xcode Flipper)使用不同类型的 Typedef 重新定义('uint8_t'(又名'unsigned char')与'enum Clockid_t')

我的目标是运行反应本机构建(ios 版本)。

情况1

  • 行动:启动地铁(确定)
  • 构建 ios。问题:构建失败,退出代码为 1。
(CompileC /Users/macbook/Library/Developer/Xcode/DerivedData/NAME_OF_PROJECT-gxlagomyefvmjkdemiakcfycxnhx/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Flipper.build/Objects-normal/x86_64/FlipperRSocketResponder.o /Users/macbook/Documents/work/omg/mobile/ios/Pods/Flipper/xplat/Flipper/FlipperRSocketResponder.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler)
Run Code Online (Sandbox Code Playgroud)

情况2

  • 行动:构建ios。
  • 问题: 脚蹼::Typedef redefinition with different types ('uint8_t' (aka 'unsigned char') vs 'enum clockid_t'

版本

  • Xcode 版本 12.5
  • IOS 9+
  • 苹果12

我尝试过的一些操作不起作用:

  1. 解决方案1

  2. 解决方案2

  3. 重新安装所有 pod

  4. 更新所有 Pod

  5. 雷克隆项目

    • rm -Rf Pod/*
    • pod 缓存清理 --all
    • 吊舱安装

以及其他一些小修复。任何帮助,将不胜感激。

xcode ios flipper react-native

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