xcode – CGBitmapInfo swift什么是新的?
发布时间:2020-12-14 17:55:08 所属栏目:百科 来源:网络整理
导读:只是尝试使用: var context = CGBitmapContextCreate(nil,self.bounds.width as UInt,self.bounds.height as UInt,8,nil,CGColorSpaceCreateDeviceRGB(),kCGBitmapByteOrder32Big) 但它说kCGBitmapByteOrder32Big是未解析的标识符.但我在stackoverflow中找
只是尝试使用:
var context = CGBitmapContextCreate(nil,self.bounds.width as UInt,self.bounds.height as UInt,8,nil,CGColorSpaceCreateDeviceRGB(),kCGBitmapByteOrder32Big) 但它说kCGBitmapByteOrder32Big是未解析的标识符.但我在stackoverflow中找到了很多这样的例子,但是对于objectiveC.问:如何初始化/获取CGBitmapInfo 正确的语法: var context:CGContextRef = CGBitmapContextCreate(nil,UInt(self.bounds.width),UInt(self.bounds.height),CGBitmapInfo.ByteOrder32Big) 解决方法
在Swift中,这应该是CGBitmapInfo.ByteOrder32Big.您可以将其作为.ByteOrder32Big传递,因为类型CGBitmapInfo已知.
通常,TypeValue或kTypeValue形式的ObjC/C++oreFoundation枚举是Swift中的Type.Value. 你传递nil为bytesPerRow.我觉得你的意思是0.零是不一样的(虽然它可能在ObjC中为你工作). (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |