Adjusting frame of textLabel

5 posts, 1 answers
  1. Sal
    Sal avatar
    58 posts
    Member since:
    Feb 2015

    Posted 20 Nov 2015 Link to this post

         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()
            }
        }

  2. Sal
    Sal avatar
    58 posts
    Member since:
    Feb 2015

    Posted 20 Nov 2015 in reply to Sal Link to this post

    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). 
  3. DevCraft banner
  4. Answer
    Adrian
    Admin
    Adrian avatar
    167 posts

    Posted 23 Nov 2015 Link to this post

    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
  5. Sal
    Sal avatar
    58 posts
    Member since:
    Feb 2015

    Posted 25 Nov 2015 in reply to Adrian Link to this post

    Thank you Adrian, was exactly what I needed to finish updating the layout of the form. 
  6. Adrian
    Admin
    Adrian avatar
    167 posts

    Posted 25 Nov 2015 Link to this post

    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
Back to Top
DevCraft banner