Welcome, Guest
Username Password: Remember me

Date format not changing
(1 viewing) (1) Guest

TOPIC: Date format not changing

Date format not changing 1 year, 4 months ago #1

Morning

I have the following code:

SCPropertyDefinition *dueDatePropertyDef = [taskDef propertyDefinitionWithName:@"dueDate"];
dueDatePropertyDef.title = @"Review Date";


Which only gives me the day and time, whereas I want the day, month and year.

In a previous statement, I had used:

[((SCDateCell *)customCell).dateFormatter setDateFormat:@"MMM dd, yyyy"];

Obviously I cannot use customCell in this instance, but am strugglingas to what it should be changed to.

Having said that - I am not sure that the statement above is the right statement etiher.


Is this the right type of statement to use to get what I am looking for ?

Iain
  • ihmunro
  • OFFLINE
  • Expert Boarder
  • Posts: 135
  • Karma: 0

Re: Date format not changing 1 year, 4 months ago #2

Hi Iain,

Since this time the date cell is automatically generated via your class definition, you'll have to change its properties using the willConfigureCell delegate method:

 
- (void)tableViewModel:(SCTableViewModel *)tableViewModel
willConfigureCell:(SCTableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
if([cell isKindOfClass:[SCDateCell class]])
{
SCDateCell *dateCell = (SCDateCell *)cell;
[dateCell.dateFormatter setDateFormat:@"MMM dd, yyyy"];
}
}
 
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72

Re: Date format not changing 1 year, 4 months ago #3

Hi Tarek

Thanks for pointing that out.

I have added the code in, it builds ok, but the date format in the picker is in the same format.

Was there something else I needed to change ?

Iain
  • ihmunro
  • OFFLINE
  • Expert Boarder
  • Posts: 135
  • Karma: 0

Re: Date format not changing 1 year, 4 months ago #4

Is the date cell in the main model, or is it in a detail model?
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72

Re: Date format not changing 1 year, 4 months ago #5

Hi Tarek

It is the iPad example for the tasks, so to answer your question, it is in the detail model.

Iain
  • ihmunro
  • OFFLINE
  • Expert Boarder
  • Posts: 135
  • Karma: 0

Re: Date format not changing 1 year, 4 months ago #6

Hi Iain,

The most straight forward way to go for you is to place the "willConfigureCell" method code above inside DetailViewController.m (again please don't forget to have DetailViewController conform to the SCTableViewModelDelegate protocol).
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72
Time to create page: 1.67 seconds