在Swift中使用Object InitializerreplaceAllocWithZone
我最近从Xcode 7 beta 4更新了我的Xcode到Xcode 7 beta 5,并开始出现以前没有的错误。 那就是:“AllocWithZone在Swift中不可用:改为使用Object Initializers”。
这里是find错误的代码:
public func copyWithZone(zone: NSZone) -> AnyObject { let copy = self.dynamicType.allocWithZone(zone) as ChartDataSet copy.colors = colors copy.label = self.label return copy }
我用什么替代“.allocWithZone”,以便它利用对象初始值设定项代替这个对象C组件?
我使用这个,iOS图表库适用于我:
let copy=self.dynamicType.initialize() as! ChartDataEntry
- 应用程序在启动时被拒绝崩溃,但无法在模拟器或设备中复制,而且设备日志很模糊
- IOS7内存释放问题
- 用程序创build的UIPopoverPresentationController在iPhone上强制popup
- SDWebImage UIImageView + WebCache在64位设备上崩溃
- 如何将今天的date和时间转换为GMTFormat(10位数字)
- 未授权执行sts:AssumeRoleWithWebIdentity AWS s3 Cognitoauthentication失败
- iPhone:根据位置sorting
- iOS离线数据存储教程
- selectedBackgroundView修改contentView子视图