有人可以告诉我出了什么问题吗?
let myTitle = NSAttributedString(string: Xdevices[row].deviceName!,
attributes: [NSFontAttributeName:UIFont(name: "Georgia", size:
15.0)!,NSForegroundColorAttributeName:UIColor.orangeColor(),
NSStrikethroughStyleAttributeName: NSUnderlineStyle.StyleSingle])
错误是:
如果没有更多的上下文,表达的类型是不明确的
插入NSStrikethroughStyleAttributeName: NSUnderlineStyle.StyleSingle
答案 0 :(得分:10)
试试这个:
it('assigns a user key properly', function(done) {
request(app)
.post('/game/:username')
.send({
image: "image/png",
username: "player1",
userKey: ""
})
.expect(201)
.expect(res.body.should.have.property("userKey"))
// .expect()
.end(function(err, res) {
if (err) return done(err);
done();
})
})
let attributes = [
NSFontAttributeName: UIFont(name: "Georgia", size: 15.0)!,
NSForegroundColorAttributeName: UIColor.orangeColor(),
NSStrikethroughStyleAttributeName: NSNumber(integer: NSUnderlineStyle.StyleSingle.rawValue)
]
let myTitle = NSAttributedString(string: Xdevices[row].deviceName!, attributes: attributes)
需要一个NSAttributedString(string:attributes:)
类型的字典。但是,[String: AnyObject]
是StyleSingle
。因此,您必须将其包装在Int
。