CNContactViewController navigation bar different between versions

后端 未结 5 688
[愿得一人]
[愿得一人] 2021-01-14 00:00

Our tint color is white. Our app uses CNContactViewController. In our version of the app in the store built with Xcode 7 targeting iOS 8 and 9, if you were iOS 9 we called

5条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-14 00:13

    By using Debug View Hierarchy of XCode, I find the alpha of the subview named "_UIBarBackground" of UINavigationBar turns to be 0 after CNContactViewController has been pushed.

    The following code helps me solve the problem (It works well in iOS 11):

    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
            for (UIView *view in self.navigationController.navigationBar.subviews) {
                if ([view isKindOfClass:NSClassFromString(@"_UIBarBackground")]) {
                    view.alpha = 1;
                    break;
                }
            }
        });
    

提交回复
热议问题