Switch in UIAlert Controller programmatically

后端 未结 4 1602
天命终不由人
天命终不由人 2021-02-06 09:50

I am creating an registration dialog in swift with 3 text field and one Switch and I successfully add three text field two the Alert. The following code shows the same.

4条回答
  •  悲哀的现实
    2021-02-06 10:42

    If you use Recycled Steel's answer above with iOS 13 you can use SF Symbols instead of PNGs. It will solve any scaling issues you might have.

        checkbox.imageView.tintColor = UIColor.blackColor;
        if (@available(iOS 13.0, *)) {
            [checkbox setImage: [UIImage systemImageNamed:@"square"] forState: UIControlStateNormal];
            [checkbox setImage: [UIImage systemImageNamed:@"checkmark.square"] forState: UIControlStateHighlighted];
            [checkbox setImage: [UIImage systemImageNamed:@"checkmark.square"] forState: UIControlStateSelected];
        }
    

提交回复
热议问题