Could not find an overload for 'init' that accepts the supplied arguments
... Ben kullanmaya çalıştığınızda ...
extension UIFont {
func sizeOfString (string: String, constrainedToWidth width: Double) -> CGSize {
NSString(string).boundingRectWithSize(CGSize(width, DBL_MAX),
options: NSStringDrawingOptions.UsesLineFragmentOrigin,
attributes: [NSFontAttributeName: self],
context: nil).size
}
}
NSString
artık bu yöntemi desteklemez, yoksa üzerinde berbat ediyorum sözdizimi?
burada görmek, aynı q ham hızlı bir şekilde yutturma: [https://stackoverflow.com/questions/30450434/figure-out-size-of-uilabel-based-on-string-in-swift/30450559#30450559] (https: // stackoverflow .com/question/30450434/shape-out-size-u-dilabel-on-string-in-swift/30450559 # 30450559) – zzycami