The issue is that you need to assign self.title
the correct date value.
The line:
self.title = NSDate()
is assigning self.title
to a new instance of NSDate()
, while you want to assign it to the formatted date that you have above, convertedDate, which is also a
String`.
Additionally, NSDate()
is of type NSDate
and not of type String
. If you converted it to a String
it would be unformatted.
So really, you need the line to be:
self.title = convertedDate
solved Adding a self populating date into the Navigation Bar Title [closed]