0

在此处输入图像描述 在此处输入图像描述

应用程序在通过 Bridging-Header.h 更新到 SWIFT 4.0 之前没有问题现在我在通过以下方式导入的 Objective-C 文件中出现错误:SWIFT 4.0; 代码 9.1。

我在这里问与大多数人类似的问题的唯一原因 - 所有其他答案都是关于 SWIFT。此错误在 OBJECTIVE-C 文件中。这并不重要,程序运行良好,但如何修复错误(而不是隐藏)。

#pragma mark Containment view controller deployment and transition

// Containment Deploy method. Returns a block to be invoked at the
// animation completion, or right after return in case of non-animated deployment.
- (void (^)(void))_deployForViewController:(UIViewController*)controller inView:(UIView*)view
{
    if ( !controller || !view )
        return ^(void){};

    CGRect frame = view.bounds;

    UIView *controllerView = controller.view;
    controllerView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
    controllerView.frame = frame;

    if ( [controllerView isKindOfClass:[UIScrollView class]] )
    {
        BOOL adjust = controller.automaticallyAdjustsScrollViewInsets;

        if ( adjust )
        {
            [(id)controllerView setContentInset:UIEdgeInsetsMake(statusBarAdjustment(_contentView), 0, 0, 0)];
        }
    }

    [view addSubview:controllerView];

    void (^completionBlock)(void) = ^(void)
    {
        // nothing to do on completion at this stage
    };

    return completionBlock;
}
4

1 回答 1

1

这与 Swift 无关。

automaticallyAdjustsScrollViewInsets如错误消息所述, iOS 11 中已弃用UIViewController 属性。请contentInsetAdjustmentBehavior改用UIScrollView

于 2017-12-02T20:34:55.037 回答