core data - populate a button from coredata -


let me know I am spending a lot of time thinking about this and I am not saying.

I have a unit with NSDate attribute, which successfully saves.

How can I get NSDT from the shop (Year-only section) on the earth and to populate the text on a button so the button can be pressed later and it can be suppressed by other view controller / The table can be moved to the view controller.

I have spent hours trying to find out, I can not completely stop any example.

Is it time to help someone with this help please use Swift (hopefully I have made this question correctly, here is a bit of a knot) Thanks Thanks for watching

  // year button @electionfunt btn-ear (sender: anyObject) {// APP DEL REFERENCE Var APPEAL: APP DELEGET = (UIApplication.sharedApplication (). Representative as AppDelegate) Var Reference: NSManagedObjectContext = appdel.managedObjectContext! Let ent = NSEntityDescription.entityForName ("ObjectInfo", managed object contex: references)! // Request Request var request = NSFetchRequest (unit name: "Film Info") request.returnsObjectsAsFaults = false 
itemprop = " Text ">

First of all, get the date with your data.

  object.date   

Then, format it so that you can display it on the button.

  var formatter = NSDateFormatter () formatter.dateStyle = .ShortStyle Let's do the button title = formatter.stringFromDate (object.date)   

Finally assign the title to the button

  button. Settill (Buttonal, Forrest: Normal)   

To get the object in the first place, get it executed Do not forget to make your fetch request. Request.redicate = NSPredicate (format: "id =% @", AFilmInfoID) // example request.fetchLimit = 1 result

  var request = NSFetchRequest (entity name: "Film Info" Reference. ExecuteFetchRequest (request, error: zero)! [FilmInfo] object = result as. First!    

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -