Exemple #1
0
    def create(self):
        self.native = UILabel.new()
        self.native.impl = self
        self.native.interface = self

        self.native.lineBreakMode = NSLineBreakByWordWrapping

        # Add the layout constraints
        self.add_constraints()
Exemple #2
0
    def create(self):
        self.native = UILabel.new()
        self.native.impl = self
        self.native.interface = self

        self.native.lineBreakMode = NSLineBreakByWordWrapping

        # Add the layout constraints
        self.add_constraints()
Exemple #3
0
    def create(self):
        self.native = UILabel.new()
        self.native.interface = self

        self.native.setTranslatesAutoresizingMaskIntoConstraints_(False)
        self.native.setLineBreakMode_(NSLineBreakByWordWrapping)

        # Add the layout constraints
        self.add_constraints()
Exemple #4
0
    def create(self):
        self.native = UIStackView.alloc().init()
        self.native.interface = self.interface
        self.native.axis = UILayoutConstraintAxis.Horizontal

        self.native_label = UILabel.alloc().init()

        self.native_switch = TogaSwitch.alloc().init()
        self.native_switch.interface = self.interface
        self.native_switch.addTarget_action_forControlEvents_(self.native_switch, SEL('onPress:'),
                                                              UIControlEventValueChanged)
        # Add switch and label to UIStackView
        self.native.addArrangedSubview_(self.native_label)
        self.native.addArrangedSubview_(self.native_switch)
        
        # Add the layout constraints
        self.add_constraints()
Exemple #5
0
    def create(self):
        self.native = UIStackView.alloc().init()
        self.native.interface = self.interface
        self.native.axis = UILayoutConstraintAxis.Horizontal

        self.native_label = UILabel.alloc().init()

        self.native_switch = TogaSwitch.alloc().init()
        self.native_switch.interface = self.interface
        self.native_switch.addTarget_action_forControlEvents_(self.native_switch, SEL('onPress:'),
                                                              UIControlEventValueChanged)
        # Add switch and label to UIStackView
        self.native.addArrangedSubview_(self.native_label)
        self.native.addArrangedSubview_(self.native_switch)
        
        # Add the layout constraints
        self.add_constraints()
Exemple #6
0
    def create(self):
        self.native = TogaMultilineTextView.alloc().init()
        self.native.delegate = self.native

        # Placeholder isn't natively supported, so we create our
        # own
        self.placeholder_label = UILabel.alloc().init()
        self.placeholder_label.translatesAutoresizingMaskIntoConstraints = False
        self.placeholder_label.font = self.native.font
        self.placeholder_label.alpha = 0.5
        self.native.addSubview_(self.placeholder_label)
        self.constrain_placeholder_label()

        # Delegate needs to update the placeholder depending on
        # input, so we give it just that to avoid a retain cycle
        self.native.placeholder_label = self.placeholder_label

        self.add_constraints()
Exemple #7
0
    def create(self):
        self.native = TogaMultilineTextView.alloc().init()
        self.native.delegate = self.native

        # Placeholder isn't natively supported, so we create our
        # own
        self.placeholder_label = UILabel.alloc().init()
        self.placeholder_label.translatesAutoresizingMaskIntoConstraints = False
        self.placeholder_label.font = self.native.font
        self.placeholder_label.alpha = 0.5
        self.native.addSubview_(self.placeholder_label)
        self.constrain_placeholder_label()

        # Delegate needs to update the placeholder depending on
        # input, so we give it just that to avoid a retain cycle
        self.native.placeholder_label = self.placeholder_label

        self.add_constraints()