Exemple #1
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 #2
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 #3
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 #4
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()