I am trying to show an Activity Indicator View once a button is pressed, but it does not want to show. If I don't set it to hidden at all, it shows, and when I try hide it, it hides. But if it is hidden, it will not show again.
Here is the code:
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
loading.hidden = true
}
@IBAction func submit() {
loading.hidden = false
loading.startAnimating()
if chosenCategory == "" || txtName.text == "" || txtEmail.text == "" {
loading.stopAnimating()
loading.hidden = true
} else {
println("animation")
No matter what, the stop animation works, and it can hide, but no matter what I do, it just seems to skip the loading.hidden = false
and goes straight to printing the message out.
What could be happening?
...
is where other code goes. It calls to a server, and there is a waiting period (the request). And then I have even tried them in different methods – Heterogynous