I am trying to access the properties of the UITableViewCell of a QuickDialog form.
More specifically, I am trying to access the accessoryView property of a QEntryElement (QDateTimeInlineElement), which is "hidden" in the property list of the object I create.
I am trying to access the cell using
UITableViewCell *thisCell = [dateelement getCellForTableView:self.quickDialogTableView controller:self];
But for some reasons nothing is displayed. I am trying to insert a UIButton in it, like this:
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
[button setTitle:@"=" forState:UIControlStateNormal];
button.frame = CGRectMake(0, 0, 24, 24);
and then thisCell.accessoryView = button;
Am I accessing the property in a wrong way or maybe the button is not created at all? No errors are displayed, but the accessoryView is empty.
Thank you in advance
This issue looks very close to what you are asking. Basically, you first have to provide your own QuickDialogStyleProvider
, implementing the cell:willAppearForElement:atIndexPath:
method the way escoz suggests there:
Once you get the call in the provider method, you have full control of the cell. You can just check if the cell is of type
QEntryTableViewCell
, and if it is, cast to that type and change the color/font of thetextField
property. A nice side effect is that this will also change the color for all subclasses, like the radio button, date/time fields, etc..
So, in your case you'd do something like
- (void)viewDidLoad
{
self.quickDialogTableView.styleProvider = self;
}
- (void)cell:(UITableViewCell *)cell willAppearForElement:(QElement *)element atIndexPath:(NSIndexPath *)indexPath
{
if([cell isKindOfClass:[QDateTimeInlineElement class]])
{
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
[button setTitle:@"=" forState:UIControlStateNormal];
button.frame = CGRectMake(0, 0, 24, 24);
cell.accessoryView = button;
}
}
Sorry if it's not fully correct, I'm away from Xcode at the moment.