Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mask Template doesn't seem correctly #3

Closed
loplopLover opened this issue Sep 1, 2015 · 2 comments
Closed

Mask Template doesn't seem correctly #3

loplopLover opened this issue Sep 1, 2015 · 2 comments

Comments

@loplopLover
Copy link

Hello again,

I set textfield mask template like as XXX-XXXXXX; however, when I start application, it seems *** - ******.
How can I fix it? Also I wonder how can I control that all fields are completed or not?

    switch maskField.maskStatus {
    case .Clear:
        statusColor = UIColor(red: 241/255, green: 241/255, blue: 241/255, alpha: 1.0)
    case .Incomplete:
        saveButton.backgroundColor = UIColor(red: 123/255, green: 166/255, blue: 55/255, alpha: 0.6)
        saveButton.removeTarget(nil, action: nil, forControlEvents: .AllEvents)
    case .Complete:
        saveButton.backgroundColor = UIColor(red: 123/255, green: 166/255, blue: 55/255, alpha: 1.0)
        saveButton.addTarget(self, action: "sendJson:", forControlEvents: UIControlEvents.TouchUpInside)
    default:
        statusColor = UIColor.clearColor()
    }

In this example, I have 3 fields and complete case works for each of them at different time. I want to make a case like as complete to control all fields at same time. If all fields are not empty then complete case works.

Best regards,

Haydar

@loplopLover loplopLover changed the title Mask doesn't seem correctly Mask Template doesn't seem correctly Sep 2, 2015
@artemkrachulov
Copy link
Owner

Hi, thx for comment.

Mask template has been fixed. Sorry for that ))

Regarding controlling all fields I can propose follow solution:

@IBOutlet weak var firstField: AKMaskField!
@IBOutlet weak var secondField: AKMaskField!

func maskField(maskField: AKMaskField, shouldChangeCharacters oldString: String, inRange range: NSRange, replacementString withString: String) {

    if firstField.maskStatus == .Complete && secondField.maskStatus == .Complete {
        println("All fields are completed ")
    }        
}

@loplopLover
Copy link
Author

Hi Artem,

Thank you very much. They all work well.

Best regards,
Haydar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants