gpt4 book ai didi

ios - 没有 '|' 候选产生预期的上下文结果类型 'CGGradientDrawingOptions'

转载 作者:行者123 更新时间:2023-11-28 12:43:22 24 4
gpt4 key购买 nike

<分区>

回顾一个旧项目,我打算添加一些功能,但遇到了这个错误。有谁知道如何消除这个?它发生在下面的代码中:

UInt32(CGGradientDrawingOptions.DrawsBeforeStartLocation) | UInt32(CGGradientDrawingOptions.DrawsAfterEndLocation))

完整文件如下:

import UIKit

class BackgroundView: UIView {

override func drawRect(rect: CGRect) {

// Background View

//// Color Declarations
var lightPurple: UIColor = UIColor(red: 0.377, green: 0.075, blue: 0.778, alpha: 1.000)
var darkPurple: UIColor = UIColor(red: 0.060, green: 0.036, blue: 0.202, alpha: 1.000)

let context = UIGraphicsGetCurrentContext()

//// Gradient Declarations
let purpleGradient = CGGradientCreateWithColors(CGColorSpaceCreateDeviceRGB(), [lightPurple.CGColor, darkPurple.CGColor], [0, 1])

//// Background Drawing
let backgroundPath = UIBezierPath(rect: CGRectMake(0, 0, self.frame.width, self.frame.height))
CGContextSaveGState(context)
backgroundPath.addClip()
CGContextDrawLinearGradient(context, purpleGradient,
CGPointMake(160, 0),
CGPointMake(160, 568),
UInt32(CGGradientDrawingOptions.DrawsBeforeStartLocation) | UInt32(CGGradientDrawingOptions.DrawsAfterEndLocation))
CGContextRestoreGState(context)

}
}

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com