nicklockwood / FXForms

[DEPRECATED]
Other
2.93k stars 339 forks source link

Where to declare form field option strings. #436

Open WA-Will opened 8 years ago

WA-Will commented 8 years ago

In your writeup (which is great by the way), you mention that options (like time from dateTime) are declared in the interface. Can you give me an example of this in a file?

nicklockwood commented 8 years ago

Which writeup are you referring to?

WA-Will commented 8 years ago

Your readme. I'm trying to declare my dateTime object as just a Time.

nicklockwood commented 8 years ago

In your form class, add the following method:

- (NSDictionary *)<nameOfYourProperty>Field {
  return @{FXFormFieldType: FXFormFieldTypeTime};
}
nicklockwood commented 8 years ago

(You don't have to declare it in the @interface, only in the @implementation)

WA-Will commented 8 years ago

Wow, that was obvious and easy. Thanks!

One more obvious and easy one. Can I change the display text string to the actual time I chose and just the time?

nicklockwood commented 8 years ago

Try

- (NSDictionary *)<nameOfYourProperty>Field {
  return @{FXFormFieldType: FXFormFieldTypeTime, FXFormFieldTitle: @""};
}
WA-Will commented 8 years ago

That wasn't quite what I was looking for. I'm trying to format the date string value. I'd like it to show only the time. And the time I've selected. Currently, it's displaying a different time.

nicklockwood commented 8 years ago

Er… that's curious. Maybe an issue with the locale being different for the picker than the label?

WA-Will commented 8 years ago

I'm getting an entire formatted date string when I choose a time. I'm hoping to make the value equal the time chosen.