我已将[String:AnyObject]
作为userdata传递给addToolTipRect ..
var myObject = [String:AnyObject]()
self.addToolTipRect( binCoordinates, owner: self, userData: &myObject )
因此,在stringForToolTip中,我需要将其转换回[String:AnyObject]
var theData = [String:AnyObject](data)
不起作用。
答案 0 :(得分:0)
// userData: UnsafeMutablePointer<Void>
let pUserData = UnsafeMutablePointer<Dictionary<String,AnyObject>>(userData)
// you can accsees all properties and functions via
pUserData.memory.myPropery // read or write myObject.myProperty
pUserData.memory.foo() // execute myObject.foo()