简体   繁体   English

光标的背景阴影在 Swift2 中的 Textfield 上发生变化

[英]Background shadow of the cursor changes on Textfield in Swift2

Hello an unusual shadow is there where the cursor is placed please help me to remove it as seen at the screenshot .?您好,光标所在的位置有不寻常的阴影,请帮我将其删除,如屏幕截图所示。? thanks in advance提前致谢

        // set the shadow of view
        loginView.backgroundColor = UIColor(red: 255.0/255.0, green: 255.0/255.0, blue: 255.0/255.0, alpha: 0.6)
        loginView.layer.shadowRadius = 10
        loginView.layer.shadowOffset = CGSizeMake(0, 0)
        loginView.layer.shadowColor = UIColor.blackColor().CGColor
        loginView.clipsToBounds = false
        self.loginView.layer.shadowOpacity = 0.3;

        loginView.layer.cornerRadius = 10
        loginView.layer.masksToBounds = true

here i set the delegate the of textfield在这里我设置了文本字段的代表

countryNameText.delegate = self
        countryNameText.tag = 1
        mobileNumberText.delegate = self
        mobileNumberText.tag = 2

this code is used to set gradient colour of view此代码用于设置视图的渐变颜色

func gradient() {
        let gradient: CAGradientLayer = CAGradientLayer()
        gradient.frame = self.view.bounds
        gradient.colors = [UIColor(red: 26.0/255.0, green: 159.0/255.0, blue: 154.0/255.0, alpha: 0.2).CGColor,  UIColor(red: 26.0/255.0, green: 159.0/255.0, blue: 154.0/255.0, alpha: 0.5).CGColor , UIColor(red: 26.0/255.0, green: 159.0/255.0, blue: 154.0/255.0, alpha: 0.9).CGColor ]
        gradient.startPoint = CGPoint(x: 0, y: 0)
        gradient.endPoint = CGPoint(x: 1, y: 1)
        self.view.layer.insertSublayer(gradient, atIndex: 0)
    }

在此处输入图片说明

just remove this line I hope this will work for you !!只需删除这一行我希望这对你有用!!

loginView.layer.masksToBounds = true loginView.layer.masksToBounds = true

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM