ios - NSObject unable to convert string -
i have following code getting error @ wrong conversion, still learning below code trying do, not sure code means yet.
let padding = 353 let minheighttext: nsstring = "\n\n" let font = uifont(name: "avenir light", size: 15.0)! let attributes = [nsfontattributename: font] nsdictionary let item = items[indexpath.row] let minsize = minheighttext.boundingrectwithsize(cgsize(width: (view.frame.size.width - 40), height: 1000), options: .useslinefragmentorigin, attributes: attributes [nsobject : anyobject] [nsobject : anyobject], context: nil).height let maxsize = item.itemdesctiption.boundingrectwithsize(cgsize(width: (view.frame.size.width - 40), height: 1000), options: .useslinefragmentorigin, attributes: attributes [nsobject : anyobject] [nsobject : anyobject], context: nil).height + 50
the error getting this..
/users/david/desktop/ios_app/bid-hub-app/ios-app/bidhub-ios-master/auctionapp/itemlist/itemlistviewcontroller.swift:140:215: cannot convert value of type '[nsobject : anyobject]' expected argument type '[string : anyobject]?' /users/david/desktop/ios_app/bid-hub-app/ios-app/bidhub-ios-master/auctionapp/itemlist/itemlistviewcontroller.swift:138:208: cannot convert value of type '[nsobject : anyobject]' expected argument type '[string : anyobject]?'
no need casting attributes
nsdictionary
. make following changes:
let attributes = [nsfontattributename: font] nsdictionary
should be
let attributes = [nsfontattributename: font]
and remove casting [nsobject : anyobject]
Comments
Post a Comment