-1

so i have 3 buttons. the first one for take a picture/pick image from gallery the second one for take an autograph and segue it to another view controller the last one is the next button

i want to disable my next button if the user have not full fill the image and the signature.And enable the button if user already full fill the image and the signature

Indra Sen
  • 37
  • 2
  • 8

1 Answers1

2

Probably not the best solution but this should work:

    button3.isEnabled = false

    var signature: String = "" {
        didSet {
            button3.isEnabled = (image != nil && signature != "")
        }
    }


    var image: UIImage? {
        didSet {
            button3.isEnabled = (image != nil && signature != "")
        }
    }
Rakesha Shastri
  • 11,053
  • 3
  • 37
  • 50
Vollan
  • 1,887
  • 11
  • 26
  • but the second button make a segue to another viewcontroller then save the signature at another viewcontroller.How to check the variabel ? sorry iam new at swift – Indra Sen Jul 18 '18 at 08:44
  • Ok, first of all, do you have to have a image before creating a signature? and in which viewController are your 3rd button? – Vollan Jul 18 '18 at 08:54