iOS 7 tabBar-line, how to remove it?

前端 未结 12 1291
执笔经年
执笔经年 2021-01-31 07:52

Apple has added a tiny line over the tabBar in iOS 7 which is supposed to work as a shadow or fade between the tabBar and the UI

12条回答
  •  一向
    一向 (楼主)
    2021-01-31 08:38

    Try this, ** Objective-C **

    //Remove shadow image by assigning nil value.
    [[UITabBar appearance] setShadowImage: nil];
    
    // or 
    
    // Assing UIImage instance without image reference
    [[UITabBar appearance] setShadowImage: [[UIImage alloc] init]];
    

    ** Swift **

    //Remove shadow image by assigning nil value.
    UITabBar.appearance().shadowImage = nil
    
    // or 
    
    // Assing UIImage instance without image reference
    UITabBar.appearance().shadowImage = UIImage()
    


    Here is apple document for shadowImage.

    @available(iOS 6.0, *)
    open var shadowImage: UIImage?
    

    Default is nil. When non-nil, a custom shadow image to show instead of the default shadow image. For a custom shadow to be shown, a custom background image must also be set with -setBackgroundImage: (if the default background image is used, the default shadow image will be used).

提交回复
热议问题