Skip to content

Trying to use Placeholder to insert UILabel #283

@getmetorajesh

Description

@getmetorajesh

I am trying to add UILabel returned from a cocoapods library in place of a placeholder {N} element. As a simple test/experiment I created the label within the creatingView() event as show below,

public creatingView(e: any) {
  var nativeLabel = new UILabel(CGRectMake(10,30, 200, 60));
  nativeLabel.text = "Native"; 
  console.log(e.object); // Placeholder(8)
  console.log(e.view); // undefined
  e.view = nativeLabel;
  console.log(e.view); //<UILabel: 0x7a942e60; frame = (0 0; 200 60); text = 'Native';     userInteractionEnabled = NO; layer = <_UILabelLayer: 0x7a9438a0>>`
}

// My template 
<Label text="above the placeholder"></Label>
<Placeholder (creatingView)="creatingView($event)"></Placeholder>
<Label text="below the placeholder"></Label>

e.view = nativeLabel; //<UILabel: 0x7a942e60; frame = (0 ...
Though the placeholder seems to have updated with the UILabel the simulator does not show it. Any thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions