FXForms icon indicating copy to clipboard operation
FXForms copied to clipboard

Modify title in CustomButtonCell

Open brdp opened this issue 11 years ago • 3 comments

Hi Nick, I'm working on a CostomButtonCell starting from your example code, I need to modify the Button Title Text and I'm trying to modify it using the FXForms field.title property.

I added the Title property in NSDictionary, modified the CustomButtonCell.m and implemented the method awakeFromNib... But it doesn't work because self.field.title is nil in that point.

Am I wrong?

Thanx in advance. G

Here it is the code:

// // LoginForm.m // BasicExample // // Created by Nick Lockwood on 05/02/2014. // Copyright (c) 2014 Charcoal Design. All rights reserved. //

import "LoginForm.h"

import "CustomButtonCell.h"

@implementation LoginForm

(NSArray *)extraFields { return @[

 //we declare our custom submit buytton cell as normal, but note that
 //we have specified that we want to use our CustomButtonCell class
 //instead of the default FXFormBaseCell

 @{FXFormFieldCell: [CustomButtonCell class], FXFormFieldTitle:@"TEST TITLE", FXFormFieldHeader: @"", FXFormFieldAction: @"submitLoginForm"},

 ];

} @end

import "CustomButtonCell.h"

@interface CustomButtonCell () @property (nonatomic, strong) IBOutlet UIButton *cellButton; @end

@implementation CustomButtonCell

(void)awakeFromNib { [self.cellButton setTitle:self.field.title forState:UIControlStateNormal]; } (IBAction)buttonAction { if (self.field.action) self.field.action(self); }

@end

brdp avatar Jun 25 '14 14:06 brdp

@brdp how did you solve this issue?

yakubbaev avatar Jan 22 '15 16:01 yakubbaev

Unfortunately I haven't solved yet... :( I'm working on a different project and we are not using FXForms. :(

brdp avatar Feb 05 '15 10:02 brdp

If this helps, I was able to change the title directly in the .xib file for the custome button (CustomButtonCell.xib)

frakman1 avatar Nov 04 '15 19:11 frakman1