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

Change alignment between textLabel and valueField

1 Answer 29 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.
yahya
Top achievements
Rank 1
yahya asked on 10 Apr 2016, 11:29 AM

i need to change alignment textLabel to right, and set the field of value on left.

This user interface way used for arab user.

i'm tired for change the frame or anything like this in dataForm between them.

The attached image said what i need exactly, Thank You.

1 Answer, 1 is accepted

Sort by
0
Adrian
Telerik team
answered on 14 Apr 2016, 08:22 AM
Hi,

I apologize for the late reply.
TKDataForm doesn't support right to left layout out of the box, however this can be easily achieved by manually arranging the views in the editors. You can see an example of manual arrangement in the Alignment example in our TelerikUIExamples application. The code below shows how to arrange the views like in the attached screenshot:
- (void)performRightToLeftSettingsForEditor:(TKDataFormEditor *)editor property:(TKEntityProperty *)property
{
    editor.style.separatorColor = nil;
    editor.textLabel.font = [UIFont systemFontOfSize:15];
    editor.style.insets = UIEdgeInsetsMake(1, editor.style.insets.left, 5, editor.style.insets.right);
 
     
    TKGridLayout *gridLayout = editor.gridLayout;
    TKGridLayoutCellDefinition *editorDefinition = [gridLayout definitionForView:editor.editor];
    editorDefinition.row = @0;
    editorDefinition.column = @1;
     
    TKGridLayoutCellDefinition *titleDefinition = [gridLayout definitionForView:editor.textLabel];
    titleDefinition.row = 0;
    titleDefinition.column = @2;
    titleDefinition.alignment = TKGridLayoutAlignmentRight | TKGridLayoutAlignmentCenterVertical;
     
    if ([property.name isEqualToString:@"dateOfBirth"]) {
        TKDataFormDatePickerEditor *dateEditor = ((TKDataFormDatePickerEditor *)editor);
        TKGridLayoutCellDefinition *labelDef = [gridLayout definitionForView:dateEditor.editorValueLabel];
        labelDef.row = @0;
        labelDef.column = @1;
    }
 
    [self setEditorStyle:editor];
}

I hope this helps.

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
yahya
Top achievements
Rank 1
Answers by
Adrian
Telerik team
Share this question
or