• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Core data - binding related problem in NSNumberFormatter and NSDatePicker
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Core data - binding related problem in NSNumberFormatter and NSDatePicker


  • Subject: Re: Core data - binding related problem in NSNumberFormatter and NSDatePicker
  • From: Flavio Donadio <email@hidden>
  • Date: Thu, 16 Dec 2010 21:45:19 -0200

Devarshi,


These are pretty simple.

> It is now working correctly when I am entering the price with $ symbol
> prefixed, eg. $123,00 :)
>
> I think that this is not user intuitive, user may not always know that he/
> she has to prefix dollar symbol. I think it would have been good if:
>
> 1. I can somehow change the alert message which now says - "Formatting
> Error" to "You should prefix dollar symbol".
>
> 2. Numberformatter can automatically prefix the '$' symbol to the entered
> decimal number.
>
> Do you know any way to implement these?

In IB, select the formatter and tivk the "lenient" checkbox. It will not require the dollar (or the localized currency symbol) anymore.

> Your interpretation is correct, when I set the default value of
> datePurchased attribute to some value say- 2010-12-10 in
> MyDocument.xcdatamodel, it started working as intended.
>
> So I am now thinking that can we set the default value to today's date in
> xcdatamodel?
>
> Also when I tried adding two or more cars and change their data value, I got
> the same problem. I used date-picker according to my requirements.

You want newly created Cars to have the datePurchased automatically set to "today"? If so, all you need to set the date at creation time is creating a custom NSManagedObject. Subclass NSManagedObject and override it's -awakeFromInsert method like below:

- (void)awakeFromInsert
{
	[self setValue:[NSDate date] forKey:@"datePurchased"];
}

Change the your xcdatamodel and select your newly create subclass for the Car entity.

Hope it helps!


Cheers,
Flavio_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Core data - binding related problem in NSNumberFormatter and NSDatePicker
      • From: mmalc Crawford <email@hidden>
  • Prev by Date: Re: NSSlider Mouse Up
  • Next by Date: Re: NSSlider Mouse Up
  • Previous by thread: Re: Core data - binding related problem in NSNumberFormatter and NSDatePicker
  • Next by thread: Re: Core data - binding related problem in NSNumberFormatter and NSDatePicker
  • Index(es):
    • Date
    • Thread