簡體   English   中英

更改背景中陰影的顏色

[英]Change color of the shadow in background

我有一個類似iOS 10 Maps-App或帶有Control Center的主屏幕的App。 例如看圖片。 如果打開控制中心,則背景陰影將變為黑色和透明。 如何訪問此層或子視圖,並將顏色從此陰影更改為我的應用程序中的另一陰影。 也許是紅色還是白色?

在此處輸入圖片說明

編輯:

也許直接與框架有關。 https://github.com/iosphere/ISHPullUp

您可以像這樣使用UIVisualEffectViewObj-C:

UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];//SELECT STYLE OF YOUR CHOICE
    UIVisualEffectView *blurEffectView = [[UIVisualEffectView alloc] initWithEffect:blurEffect];
    blurEffectView.frame = self.view.bounds;//view Will be YOUR_VIEW
    blurEffectView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

    [self.view addSubview:blurEffectView];//This add Blur view to your view

迅速:

 let blurEffect = UIBlurEffect(style: UIBlurEffectStyle.dark)
    let blurEffectView = UIVisualEffectView(effect: blurEffect)
    blurEffectView.frame = self.view.bounds
    blurEffectView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
    self.view.addSubview(blurEffectView)

有時睜開眼睛,您會找到想要的東西。 😕如果使用相同的Framework,則可以更改一個變量。 在Framework的示例中,您可以轉到“ BottomVC”,並將以下行添加到viewDidLoad()

weak var pullUpController: ISHPullUpViewController!

    override func viewDidLoad() {
       super.viewDidLoad()
       let tapGesture = UITapGestureRecognizer(target: self, action: #selector(handleTapGesture))
       topView.addGestureRecognizer(tapGesture)
       handleView.arrowSize = CGSize(width: 1 , height: 2)

      //This line change the default 40% black to a 70% white.
      pullUpController.dimmingColor = UIColor.white().withAlphaComponent(0.7)

}

“陰影”只是普通視圖。 在這里,您可以看到作者是如何實現的。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM