We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
func walkTextSpriteDescriptorWithDirection(direction:UInt) -> BarrageDescriptor{ let descriptor:BarrageDescriptor = BarrageDescriptor() descriptor.spriteName = NSStringFromClass(BarrageWalkTextSprite.self) descriptor.params["text"] = "过场文字弹幕" descriptor.params["textColor"] = UIColor(red: CGFloat(arc4random()%255) / 255, green: CGFloat(arc4random()%255) / 255, blue: CGFloat(arc4random()%255) / 255, alpha: 1) descriptor.params["speed"] = NSNumber.init(value: arc4random()%100 + 50) descriptor.params["direction"] = NSNumber.init(value: direction) descriptor.params["side"] = NSNumber.init(value: BarrageWalkSide.default.rawValue) descriptor.params["clickAction"] = { // let alertView = UIAlertView.init(title: "提示", message: "弹幕被点击", delegate: nil, cancelButtonTitle: "取消") // alertView.show() Log.shared.printLog("弹幕被点击") } return descriptor }
这样为弹幕添加了一个点击事件,但是点击之后报错 报错信息
warning: could not execute support code to read Objective-C class data in the process. This may reduce the quality of type information available.
The text was updated successfully, but these errors were encountered:
@menicor NSDictionary 不支持 value 为swift的闭包函数
Sorry, something went wrong.
@menicor �在�BarrageDescriptor类下修改代码 在.h增加方法
在.m实现方法
(void)clickAction:(BarrageClickAction)clickAction{
self.params[@"clickAction"] = clickAction;
} swift中使�用低的方法
descriptor.clickAction { (params) in // Your Code }
如果不想修改源码,继承或者为BarrageDescriptor扩展这个方法也可以
No branches or pull requests
func walkTextSpriteDescriptorWithDirection(direction:UInt) -> BarrageDescriptor{
let descriptor:BarrageDescriptor = BarrageDescriptor()
descriptor.spriteName = NSStringFromClass(BarrageWalkTextSprite.self)
descriptor.params["text"] = "过场文字弹幕"
descriptor.params["textColor"] = UIColor(red: CGFloat(arc4random()%255) / 255, green: CGFloat(arc4random()%255) / 255, blue: CGFloat(arc4random()%255) / 255, alpha: 1)
descriptor.params["speed"] = NSNumber.init(value: arc4random()%100 + 50)
descriptor.params["direction"] = NSNumber.init(value: direction)
descriptor.params["side"] = NSNumber.init(value: BarrageWalkSide.default.rawValue)
descriptor.params["clickAction"] = {
// let alertView = UIAlertView.init(title: "提示", message: "弹幕被点击", delegate: nil, cancelButtonTitle: "取消")
// alertView.show()
Log.shared.printLog("弹幕被点击")
}
return descriptor
}
这样为弹幕添加了一个点击事件,但是点击之后报错
报错信息
warning: could not execute support code to read Objective-C class data in the process. This may reduce the quality of type information available.
The text was updated successfully, but these errors were encountered: