addGestureRecognizer not firing if statement in swift4

Multi tool use
I am trying to use a if statement when the uses touches the imageview it changes the constraints. Right now my code changes from small to big but it does not change from big to small. So the if statement only works one time but does not work again.
var counter = 0
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
let tap = UITapGestureRecognizer(target: self, action: #selector(ViewController.handleRegisterC))
FIRE.addGestureRecognizer(tap)
FIRE.isUserInteractionEnabled = true
print(counter)
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
view.addSubview(FIRE)
FIRE.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true
FIRE.topAnchor.constraint(equalTo: view.topAnchor, constant: 0).isActive = true
FIRE.widthAnchor.constraint(equalToConstant: 400).isActive = true
FIRE.heightAnchor.constraint(equalToConstant: 700).isActive = true
FIRE.translatesAutoresizingMaskIntoConstraints = false
@objc func handleRegisterC(sender: UIButton){
counter += 1
if counter % 2 == 0 {
FIRE.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true
FIRE.topAnchor.constraint(equalTo: view.topAnchor, constant: 0).isActive = true
FIRE.widthAnchor.constraint(equalToConstant: 400).isActive = true
FIRE.heightAnchor.constraint(equalToConstant: 700).isActive = true
FIRE.translatesAutoresizingMaskIntoConstraints = false
}
if counter % 2 == 1 {
FIRE.topAnchor.constraint(equalTo: view.topAnchor, constant: 0).isActive = true
FIRE.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: 0).isActive = true
FIRE.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 0).isActive = true
FIRE.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: 0).isActive = true
FIRE.translatesAutoresizingMaskIntoConstraints = false
}
}
}
ios if-statement constraints swift4 uitapgesturerecognizer
add a comment |
I am trying to use a if statement when the uses touches the imageview it changes the constraints. Right now my code changes from small to big but it does not change from big to small. So the if statement only works one time but does not work again.
var counter = 0
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
let tap = UITapGestureRecognizer(target: self, action: #selector(ViewController.handleRegisterC))
FIRE.addGestureRecognizer(tap)
FIRE.isUserInteractionEnabled = true
print(counter)
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
view.addSubview(FIRE)
FIRE.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true
FIRE.topAnchor.constraint(equalTo: view.topAnchor, constant: 0).isActive = true
FIRE.widthAnchor.constraint(equalToConstant: 400).isActive = true
FIRE.heightAnchor.constraint(equalToConstant: 700).isActive = true
FIRE.translatesAutoresizingMaskIntoConstraints = false
@objc func handleRegisterC(sender: UIButton){
counter += 1
if counter % 2 == 0 {
FIRE.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true
FIRE.topAnchor.constraint(equalTo: view.topAnchor, constant: 0).isActive = true
FIRE.widthAnchor.constraint(equalToConstant: 400).isActive = true
FIRE.heightAnchor.constraint(equalToConstant: 700).isActive = true
FIRE.translatesAutoresizingMaskIntoConstraints = false
}
if counter % 2 == 1 {
FIRE.topAnchor.constraint(equalTo: view.topAnchor, constant: 0).isActive = true
FIRE.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: 0).isActive = true
FIRE.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 0).isActive = true
FIRE.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: 0).isActive = true
FIRE.translatesAutoresizingMaskIntoConstraints = false
}
}
}
ios if-statement constraints swift4 uitapgesturerecognizer
I don't think theif statement
is working only once (you can put a print statement in each block to confirm). I think the problem is that you have two sets of constraints that are active at the same time. What you probably want to do is to alternate between these two sets; setting one of them to be active while the other one to be inactive
– Malik
Jan 3 at 4:43
I dont know how to do that could you show me?
– silly milly
Jan 3 at 4:49
I've added an answer. Try adding that in your view controller
– Malik
Jan 3 at 4:54
Did the solution help?
– Malik
Jan 3 at 5:42
add a comment |
I am trying to use a if statement when the uses touches the imageview it changes the constraints. Right now my code changes from small to big but it does not change from big to small. So the if statement only works one time but does not work again.
var counter = 0
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
let tap = UITapGestureRecognizer(target: self, action: #selector(ViewController.handleRegisterC))
FIRE.addGestureRecognizer(tap)
FIRE.isUserInteractionEnabled = true
print(counter)
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
view.addSubview(FIRE)
FIRE.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true
FIRE.topAnchor.constraint(equalTo: view.topAnchor, constant: 0).isActive = true
FIRE.widthAnchor.constraint(equalToConstant: 400).isActive = true
FIRE.heightAnchor.constraint(equalToConstant: 700).isActive = true
FIRE.translatesAutoresizingMaskIntoConstraints = false
@objc func handleRegisterC(sender: UIButton){
counter += 1
if counter % 2 == 0 {
FIRE.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true
FIRE.topAnchor.constraint(equalTo: view.topAnchor, constant: 0).isActive = true
FIRE.widthAnchor.constraint(equalToConstant: 400).isActive = true
FIRE.heightAnchor.constraint(equalToConstant: 700).isActive = true
FIRE.translatesAutoresizingMaskIntoConstraints = false
}
if counter % 2 == 1 {
FIRE.topAnchor.constraint(equalTo: view.topAnchor, constant: 0).isActive = true
FIRE.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: 0).isActive = true
FIRE.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 0).isActive = true
FIRE.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: 0).isActive = true
FIRE.translatesAutoresizingMaskIntoConstraints = false
}
}
}
ios if-statement constraints swift4 uitapgesturerecognizer
I am trying to use a if statement when the uses touches the imageview it changes the constraints. Right now my code changes from small to big but it does not change from big to small. So the if statement only works one time but does not work again.
var counter = 0
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
let tap = UITapGestureRecognizer(target: self, action: #selector(ViewController.handleRegisterC))
FIRE.addGestureRecognizer(tap)
FIRE.isUserInteractionEnabled = true
print(counter)
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
view.addSubview(FIRE)
FIRE.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true
FIRE.topAnchor.constraint(equalTo: view.topAnchor, constant: 0).isActive = true
FIRE.widthAnchor.constraint(equalToConstant: 400).isActive = true
FIRE.heightAnchor.constraint(equalToConstant: 700).isActive = true
FIRE.translatesAutoresizingMaskIntoConstraints = false
@objc func handleRegisterC(sender: UIButton){
counter += 1
if counter % 2 == 0 {
FIRE.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true
FIRE.topAnchor.constraint(equalTo: view.topAnchor, constant: 0).isActive = true
FIRE.widthAnchor.constraint(equalToConstant: 400).isActive = true
FIRE.heightAnchor.constraint(equalToConstant: 700).isActive = true
FIRE.translatesAutoresizingMaskIntoConstraints = false
}
if counter % 2 == 1 {
FIRE.topAnchor.constraint(equalTo: view.topAnchor, constant: 0).isActive = true
FIRE.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: 0).isActive = true
FIRE.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 0).isActive = true
FIRE.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: 0).isActive = true
FIRE.translatesAutoresizingMaskIntoConstraints = false
}
}
}
ios if-statement constraints swift4 uitapgesturerecognizer
ios if-statement constraints swift4 uitapgesturerecognizer
asked Jan 3 at 4:15


silly millysilly milly
497
497
I don't think theif statement
is working only once (you can put a print statement in each block to confirm). I think the problem is that you have two sets of constraints that are active at the same time. What you probably want to do is to alternate between these two sets; setting one of them to be active while the other one to be inactive
– Malik
Jan 3 at 4:43
I dont know how to do that could you show me?
– silly milly
Jan 3 at 4:49
I've added an answer. Try adding that in your view controller
– Malik
Jan 3 at 4:54
Did the solution help?
– Malik
Jan 3 at 5:42
add a comment |
I don't think theif statement
is working only once (you can put a print statement in each block to confirm). I think the problem is that you have two sets of constraints that are active at the same time. What you probably want to do is to alternate between these two sets; setting one of them to be active while the other one to be inactive
– Malik
Jan 3 at 4:43
I dont know how to do that could you show me?
– silly milly
Jan 3 at 4:49
I've added an answer. Try adding that in your view controller
– Malik
Jan 3 at 4:54
Did the solution help?
– Malik
Jan 3 at 5:42
I don't think the
if statement
is working only once (you can put a print statement in each block to confirm). I think the problem is that you have two sets of constraints that are active at the same time. What you probably want to do is to alternate between these two sets; setting one of them to be active while the other one to be inactive– Malik
Jan 3 at 4:43
I don't think the
if statement
is working only once (you can put a print statement in each block to confirm). I think the problem is that you have two sets of constraints that are active at the same time. What you probably want to do is to alternate between these two sets; setting one of them to be active while the other one to be inactive– Malik
Jan 3 at 4:43
I dont know how to do that could you show me?
– silly milly
Jan 3 at 4:49
I dont know how to do that could you show me?
– silly milly
Jan 3 at 4:49
I've added an answer. Try adding that in your view controller
– Malik
Jan 3 at 4:54
I've added an answer. Try adding that in your view controller
– Malik
Jan 3 at 4:54
Did the solution help?
– Malik
Jan 3 at 5:42
Did the solution help?
– Malik
Jan 3 at 5:42
add a comment |
1 Answer
1
active
oldest
votes
I don't think the if statement
is working only once (you can put a print statement in each block to confirm). I think the problem is that you have two sets of constraints that are active at the same time. What you probably want to do is to alternate between these two sets; setting one of them to be active while the other one to be inactive. Try something like this
enum Size {
case big
case small
}
var counter = 0
override func viewDidLoad() {
super.viewDidLoad()
view.addSubview(FIRE)
changeSizeTo(.small)
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
let tap = UITapGestureRecognizer(target: self, action: #selector(ViewController.handleRegisterC))
FIRE.addGestureRecognizer(tap)
FIRE.isUserInteractionEnabled = true
}
private func changeSizeTo(_ size: Size) {
FIRE.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = size == .small
FIRE.topAnchor.constraint(equalTo: view.topAnchor, constant: 0).isActive = size == .small
FIRE.widthAnchor.constraint(equalToConstant: 400).isActive = size == .small
FIRE.heightAnchor.constraint(equalToConstant: 700).isActive = size == .small
FIRE.topAnchor.constraint(equalTo: view.topAnchor, constant: 0).isActive = size == .big
FIRE.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: 0).isActive = size == .big
FIRE.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 0).isActive = size == .big
FIRE.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: 0).isActive = size == .big
FIRE.translatesAutoresizingMaskIntoConstraints = false
}
@objc func handleRegisterC(sender: UIButton){
counter += 1
changeSizeTo(counter % 2 == 0 ? .small : .big)
}
I tried your code but it is have the same effect. It works once then it does not work again in the xcode log there is a lot of complaints of constraints.
– silly milly
Jan 4 at 1:10
Can you upload your project somewhere and share the link?
– Malik
Jan 7 at 0:28
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54016270%2faddgesturerecognizer-not-firing-if-statement-in-swift4%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I don't think the if statement
is working only once (you can put a print statement in each block to confirm). I think the problem is that you have two sets of constraints that are active at the same time. What you probably want to do is to alternate between these two sets; setting one of them to be active while the other one to be inactive. Try something like this
enum Size {
case big
case small
}
var counter = 0
override func viewDidLoad() {
super.viewDidLoad()
view.addSubview(FIRE)
changeSizeTo(.small)
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
let tap = UITapGestureRecognizer(target: self, action: #selector(ViewController.handleRegisterC))
FIRE.addGestureRecognizer(tap)
FIRE.isUserInteractionEnabled = true
}
private func changeSizeTo(_ size: Size) {
FIRE.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = size == .small
FIRE.topAnchor.constraint(equalTo: view.topAnchor, constant: 0).isActive = size == .small
FIRE.widthAnchor.constraint(equalToConstant: 400).isActive = size == .small
FIRE.heightAnchor.constraint(equalToConstant: 700).isActive = size == .small
FIRE.topAnchor.constraint(equalTo: view.topAnchor, constant: 0).isActive = size == .big
FIRE.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: 0).isActive = size == .big
FIRE.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 0).isActive = size == .big
FIRE.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: 0).isActive = size == .big
FIRE.translatesAutoresizingMaskIntoConstraints = false
}
@objc func handleRegisterC(sender: UIButton){
counter += 1
changeSizeTo(counter % 2 == 0 ? .small : .big)
}
I tried your code but it is have the same effect. It works once then it does not work again in the xcode log there is a lot of complaints of constraints.
– silly milly
Jan 4 at 1:10
Can you upload your project somewhere and share the link?
– Malik
Jan 7 at 0:28
add a comment |
I don't think the if statement
is working only once (you can put a print statement in each block to confirm). I think the problem is that you have two sets of constraints that are active at the same time. What you probably want to do is to alternate between these two sets; setting one of them to be active while the other one to be inactive. Try something like this
enum Size {
case big
case small
}
var counter = 0
override func viewDidLoad() {
super.viewDidLoad()
view.addSubview(FIRE)
changeSizeTo(.small)
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
let tap = UITapGestureRecognizer(target: self, action: #selector(ViewController.handleRegisterC))
FIRE.addGestureRecognizer(tap)
FIRE.isUserInteractionEnabled = true
}
private func changeSizeTo(_ size: Size) {
FIRE.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = size == .small
FIRE.topAnchor.constraint(equalTo: view.topAnchor, constant: 0).isActive = size == .small
FIRE.widthAnchor.constraint(equalToConstant: 400).isActive = size == .small
FIRE.heightAnchor.constraint(equalToConstant: 700).isActive = size == .small
FIRE.topAnchor.constraint(equalTo: view.topAnchor, constant: 0).isActive = size == .big
FIRE.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: 0).isActive = size == .big
FIRE.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 0).isActive = size == .big
FIRE.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: 0).isActive = size == .big
FIRE.translatesAutoresizingMaskIntoConstraints = false
}
@objc func handleRegisterC(sender: UIButton){
counter += 1
changeSizeTo(counter % 2 == 0 ? .small : .big)
}
I tried your code but it is have the same effect. It works once then it does not work again in the xcode log there is a lot of complaints of constraints.
– silly milly
Jan 4 at 1:10
Can you upload your project somewhere and share the link?
– Malik
Jan 7 at 0:28
add a comment |
I don't think the if statement
is working only once (you can put a print statement in each block to confirm). I think the problem is that you have two sets of constraints that are active at the same time. What you probably want to do is to alternate between these two sets; setting one of them to be active while the other one to be inactive. Try something like this
enum Size {
case big
case small
}
var counter = 0
override func viewDidLoad() {
super.viewDidLoad()
view.addSubview(FIRE)
changeSizeTo(.small)
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
let tap = UITapGestureRecognizer(target: self, action: #selector(ViewController.handleRegisterC))
FIRE.addGestureRecognizer(tap)
FIRE.isUserInteractionEnabled = true
}
private func changeSizeTo(_ size: Size) {
FIRE.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = size == .small
FIRE.topAnchor.constraint(equalTo: view.topAnchor, constant: 0).isActive = size == .small
FIRE.widthAnchor.constraint(equalToConstant: 400).isActive = size == .small
FIRE.heightAnchor.constraint(equalToConstant: 700).isActive = size == .small
FIRE.topAnchor.constraint(equalTo: view.topAnchor, constant: 0).isActive = size == .big
FIRE.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: 0).isActive = size == .big
FIRE.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 0).isActive = size == .big
FIRE.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: 0).isActive = size == .big
FIRE.translatesAutoresizingMaskIntoConstraints = false
}
@objc func handleRegisterC(sender: UIButton){
counter += 1
changeSizeTo(counter % 2 == 0 ? .small : .big)
}
I don't think the if statement
is working only once (you can put a print statement in each block to confirm). I think the problem is that you have two sets of constraints that are active at the same time. What you probably want to do is to alternate between these two sets; setting one of them to be active while the other one to be inactive. Try something like this
enum Size {
case big
case small
}
var counter = 0
override func viewDidLoad() {
super.viewDidLoad()
view.addSubview(FIRE)
changeSizeTo(.small)
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
let tap = UITapGestureRecognizer(target: self, action: #selector(ViewController.handleRegisterC))
FIRE.addGestureRecognizer(tap)
FIRE.isUserInteractionEnabled = true
}
private func changeSizeTo(_ size: Size) {
FIRE.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = size == .small
FIRE.topAnchor.constraint(equalTo: view.topAnchor, constant: 0).isActive = size == .small
FIRE.widthAnchor.constraint(equalToConstant: 400).isActive = size == .small
FIRE.heightAnchor.constraint(equalToConstant: 700).isActive = size == .small
FIRE.topAnchor.constraint(equalTo: view.topAnchor, constant: 0).isActive = size == .big
FIRE.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: 0).isActive = size == .big
FIRE.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 0).isActive = size == .big
FIRE.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: 0).isActive = size == .big
FIRE.translatesAutoresizingMaskIntoConstraints = false
}
@objc func handleRegisterC(sender: UIButton){
counter += 1
changeSizeTo(counter % 2 == 0 ? .small : .big)
}
answered Jan 3 at 4:54
MalikMalik
2,36911026
2,36911026
I tried your code but it is have the same effect. It works once then it does not work again in the xcode log there is a lot of complaints of constraints.
– silly milly
Jan 4 at 1:10
Can you upload your project somewhere and share the link?
– Malik
Jan 7 at 0:28
add a comment |
I tried your code but it is have the same effect. It works once then it does not work again in the xcode log there is a lot of complaints of constraints.
– silly milly
Jan 4 at 1:10
Can you upload your project somewhere and share the link?
– Malik
Jan 7 at 0:28
I tried your code but it is have the same effect. It works once then it does not work again in the xcode log there is a lot of complaints of constraints.
– silly milly
Jan 4 at 1:10
I tried your code but it is have the same effect. It works once then it does not work again in the xcode log there is a lot of complaints of constraints.
– silly milly
Jan 4 at 1:10
Can you upload your project somewhere and share the link?
– Malik
Jan 7 at 0:28
Can you upload your project somewhere and share the link?
– Malik
Jan 7 at 0:28
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54016270%2faddgesturerecognizer-not-firing-if-statement-in-swift4%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
iEP0r3yOLjpOApi 8jz,W9msPUuiCJ13 00YG48ojSC3D8lWWHDpFzU4S9kBV jIWKIVYXGqhJi
I don't think the
if statement
is working only once (you can put a print statement in each block to confirm). I think the problem is that you have two sets of constraints that are active at the same time. What you probably want to do is to alternate between these two sets; setting one of them to be active while the other one to be inactive– Malik
Jan 3 at 4:43
I dont know how to do that could you show me?
– silly milly
Jan 3 at 4:49
I've added an answer. Try adding that in your view controller
– Malik
Jan 3 at 4:54
Did the solution help?
– Malik
Jan 3 at 5:42