添加倾斜阴影以快速查看

时间:2018-11-25 10:38:53

标签: swift uiview shadow

我是ios开发的新手,我正在尝试在textview上添加阴影。

This is expected image with shadow:-

This is what I am getting after applying shadow

我已使用以下代码应用阴影-

func setUpText(){
        //Add the label
        stickerView.addLabel()

        //add shadow to textview
        stickerView.textShadowColor = stickerView.textColor
        stickerView.textShadowOffset = CGSize(width:8, height:8)

        //Modify the Label
        stickerView.textColor = UIColor.white
        stickerView.textAlpha = 1
        stickerView.currentlyEditingLabel.closeView!.image = UIImage(named: "cross")
        stickerView.currentlyEditingLabel.rotateView?.image = UIImage(named: "rotate")
        stickerView.currentlyEditingLabel.border?.strokeColor = UIColor.white.cgColor
        stickerView.currentlyEditingLabel.labelTextView?.font = UIFont.systemFont(ofSize: 20.0)
        globalTextView = stickerView.currentlyEditingLabel.labelTextView!


        addDoneButtonOnKeyboard(textView: stickerView.currentlyEditingLabel.labelTextView!)
        stickerView.currentlyEditingLabel.labelTextView?.becomeFirstResponder()
        // stickerView.addLabel()
        fontFamilyArr = UIFont.familyNames

        print("fontFamilyArr",fontFamilyArr)


    }

我无法理解如何获得所需的结果。请帮助我了解我应该搜索什么或应该如何实现它。 预先感谢。

1 个答案:

答案 0 :(得分:0)

您必须实质上实现渐变视图并操纵其框架。

How to Apply Gradient to background view of iOS Swift App

此答案教了如何实现渐变视图。

但是您将不得不根据需要更改渐变视图的框架。

我给了你一些基本的信息。朝那个方向搜索。