TableView /collectionView offset problem

Swift version
Objective – C version
If (@ the available (iOS 11.0, *)) { self.collectionView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; }else { self.automaticallyAdjustsScrollViewInsets = NO; }Copy the code
Swift version
         if #available(iOS 11.0, *) {
            self.tableView.contentInsetAdjustmentBehavior = .never
        } else {
            self.automaticallyAdjustsScrollViewInsets = false
        }

Copy the code

WKWebView set to full screen

Swift version

Objective – C version

If (@ the available (iOS 11.0, *)) { self.webView.scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; } else { self.automaticallyAdjustsScrollViewInsets = NO; } / / customised navigation bar color self navigationController. NavigationBar. BarStyle = UIBarStyleDefault; self.navigationController.navigationBar.tintColor = [UIColor blackColor]; / / navigation transparent and cancel dividing line [self. NavigationController. NavigationBar setBackgroundImage: [UIImage new] forBarMetrics:UIBarMetricsDefault]; [self.navigationController.navigationBar setShadowImage:[UIImage new]]; / / transparent self. NavigationController. NavigationBar. Translucent = YES;Copy the code

IOS Dark Mode

if (@available(iOS 13.0, *)) {
        self.window.overrideUserInterfaceStyle = UIUserInterfaceStyleLight;
    } else{}Copy the code

Mimicking Tiktok Tabbar transparency

    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        self.tabBarController? .tabBar.barTintColor =UIColor.clear;
        self.tabBarController? .tabBar.backgroundColor =UIColor.clear;
        self.tabBarController? .tabBar.backgroundImage =UIImage(color: UIColor.clear);
        self.tabBarController? .tabBar.shadowImage =UIImage(color: UIColor.clear);
        self.tabBarController? .tabBar.isTranslucent =true;
    }
    override func viewWillDisappear(_ animated: Bool) {
        super.viewWillDisappear(animated)
        self.tabBarController? .tabBar.barTintColor =UIColor.white;
        self.tabBarController? .tabBar.backgroundColor =UIColor.white;
        self.tabBarController? .tabBar.backgroundImage =nil;
        self.tabBarController? .tabBar.shadowImage =nil;
    }
Copy the code