xcode - Taking a Parse Date, Converting to String and Display in Cell Detail -
i trying take column createdat parse class, , display date in cell detail label (subtitle styled cell).
i doing following way:
if let createddate: anyobject = object["createdat"] as? nsdate { var dateformatter = nsdateformatter() dateformatter.dateformat = "mmm d, yyyy" var datestring = dateformatter.stringfromdate(createddate as! nsdate) if datestring.isempty { cell?.detailtextlabel?.text = "undefined" } else { cell?.detailtextlabel?.text = datestring } }
however, word "detail" below title label because @ runtime appears evaluate first let createddate: anyobject
, skips rest of code, including label assignment.
what doing wrong here?
lets start getting createdat
date. createdat
special value provided pfobject
's property. should reading this:
if let object = object as? pfobject { let createddate = object.createdat }
now give object of type nsdate
.
Comments
Post a Comment