UA-17470720-3

Jump to content


Photo
- - - - -

SCDateCell display picker by default


  • Please log in to reply
6 replies to this topic

#1 Brendan Duddridge

Brendan Duddridge

    Advanced Member

  • STV 5.0 Pro
  • PipPipPipPipPip
  • 170 posts
Reputation: 7
Good

Posted 04 June 2016 - 12:45 AM

Hi,

 

I have an SCDateCell that I would like to display on a view with the embedded UIDatePicker already visible with the user having to tap on the date row in the table.

 

I've looked through the forum and has not seen anything, nor have I seen anything in the source. There's a showEmbeddedDatePicker method, but that's private it seems.

 

​I want to be able to conditionally control this aspect of the SCDateCell.

 

Is it possible? If so, how?

 

Thanks!

 

Brendan



#2 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 04 June 2016 - 07:05 AM

Hi Brendan,

 

If I correctly understand what you want, then all you need to do is call:

 

[myDateCell becomeFirstResponder]; 


#3 Brendan Duddridge

Brendan Duddridge

    Advanced Member

  • STV 5.0 Pro
  • PipPipPipPipPip
  • 170 posts
Reputation: 7
Good

Posted 04 June 2016 - 12:12 PM

Thanks for the response Tarek!

 

Unfortunately it didn't work for me. Not sure why. In my viewDidAppear I set [self.dateCell becomeFirstResponder] but it didn't seem to have an affect.

 

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:YES];
    [self.aTableView deselectRowAtIndexPath:[self.aTableView indexPathForSelectedRow] animated:YES];
	
    if ([self.field.fieldType isEqualToString:kFieldTypeDate]) {
	[self.dateCell becomeFirstResponder];
    }
}

 

 

Unfortunately the cell is not expanded to show the UIDatePicker.



#4 Brendan Duddridge

Brendan Duddridge

    Advanced Member

  • STV 5.0 Pro
  • PipPipPipPipPip
  • 170 posts
Reputation: 7
Good

Posted 04 June 2016 - 12:24 PM

Also, I've confirmed that self.dateCell does exist at that point and the becomeFirstResponder method is being called. It's created in viewDidLoad.

 

I tried removing the line above that was deselecting the selected row, but that didn't help. I just have that in there since on this view you can navigate further down the hierarchy and I wanted to deselect the row when it was displayed again.



#5 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 04 June 2016 - 12:28 PM

This is actually a bug that should be fixed. For the time being, please use the following instead:

 

[myDateCell didSelectCell];


#6 Brendan Duddridge

Brendan Duddridge

    Advanced Member

  • STV 5.0 Pro
  • PipPipPipPipPip
  • 170 posts
Reputation: 7
Good

Posted 04 June 2016 - 12:48 PM

Bingo! That did it!

 

Thanks Tarek. You rock! And for providing support on a Saturday +100 points :-)



#7 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 04 June 2016 - 12:56 PM

hahaha always happy to help :D


  • wizgod likes this




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users