This is a migrated thread and some comments may be shown as answers.

Adjusting frame of textLabel

4 Answers 44 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Sal
Top achievements
Rank 1
Sal asked on 20 Nov 2015, 09:50 PM

     I'm trying to implement a DataForm into a current project but one of the requirements is to get the editor to have a similar visual appearance as the other areas of the app and so I need to either update the frames of the labels and other fields or is there a way to use a custom tableviewcell for the editor? I tried updating the frame using the code below, but the frame doesn't get updated (I put the blue background just so I can verify if it's changed the way I want and it still shows the same default frame. I know there's a way to change the offset, but that doesn't change the height of the labels, which is something I would need as well. 

 

override func dataForm(dataForm: TKDataForm, updateEditor editor: TKDataFormEditor, forProperty property: TKEntityProperty) {
        //for the title editor move the label above the editor
        if property.name == "title" {
            editor.textLabel.frame = CGRectMake(15, 4, self.dataForm.frame.width, 16)
            editor.textLabel.font = UIFont(name: "Helvetica-Light", size: 13)
            editor.textLabel.textColor = UIColor.darkGrayColor()
            editor.textLabel.backgroundColor = UIColor.blueColor()
        }
    }

4 Answers, 1 is accepted

Sort by
0
Sal
Top achievements
Rank 1
answered on 20 Nov 2015, 11:17 PM
So after opening up the example project and looking at some of the code I found an example with top aligned labels, so looks like using that as a sample I got mine formatted some what close to what I needed. The only other thing I can't seem to find is a way to update the titleLabel text to something else or even manipulate the existing title (like making it all uppercase). 
0
Accepted
Adrian
Telerik team
answered on 23 Nov 2015, 03:16 PM
Hi, Sal,

Thank you for writing.

The textLabel property of TKDataFormEditor shows its property's display name. So to change the text of the textLabel you should set the displayName property of the TKEntityProperty that is edited by this editor. Please consider the code snippet below:
_dataSource[@"password"].displayName = @"Enter password";

I hope this helps. Should you have further questions, do not hesitate to contact us.

Regards,
Adrian
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Sal
Top achievements
Rank 1
answered on 25 Nov 2015, 03:40 PM
Thank you Adrian, was exactly what I needed to finish updating the layout of the form. 
0
Adrian
Telerik team
answered on 25 Nov 2015, 03:44 PM
Hello, Sal,

I am glad that I could help. Should you need further assistance, feel free to contact us.

Regards,
Adrian
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
DataForm
Asked by
Sal
Top achievements
Rank 1
Answers by
Sal
Top achievements
Rank 1
Adrian
Telerik team
Share this question
or