Git Product home page Git Product logo

akmaskfield's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

akmaskfield's Issues

CocoaPods

Any chances for your lib to support CocoaPods?

MaskField in cell reloading

When table view cell will display with textField AkMaskFieldDelegate calls func maskField(_ maskField: AKMaskField, didChangedWithEvent event: AKMaskFieldEvent)
with empty string
Should not call this func when reloading

Format a label

I bring from a REST service some data (name, birthday date, etc..) without mask, these data come with a template id, so, I look inside my project for the template and for each field I look if it has a mask to apply (ex: birthday date). How to apply the mask to these value that comes from service? The mask pattern in the template come like this: ##/##/####. I can modify this pattern to work with AKMaskField, but, I`d like to know if is possible apply some mask in a table cell (label)?

Getting: fatal error: can not increment endIndex

I am getting the error: fatal error: can not increment endIndex when I move out of a masked field into an unmasked field. The culprit is in the convertRange method.

public func convertRange(range: Range<Int>) -> Range<String.Index> {

    let startIndex = advance(self.startIndex, range.startIndex)
    let endIndex = advance(startIndex, range.endIndex - range.startIndex)

    return Range<String.Index>(start: startIndex, end: endIndex)
}

My text field is basic:

phoneContactField.placeholder = "Enter your phone number"
phoneContactField.textAlignment = .Center
phoneContactField.font = UIFont.caFontWithSize(18)
phoneContactField.delegate = self
phoneContactField.mask = "({ddd}) {ddd}-{dddd}"
phoneContactField.maskDelegate = self
phoneContactField.maskTemplate = "(XXX) XXX-XXXX"
phoneContactField.maskShowTemplate = true

Any thoughts?

Mask Template doesn't seem correctly

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

Use of undeclared type 'AKMaskField'

OK What am I doing incorrectly? I am still getting the error listed above. I copied the folder AKMaskField into my project and saved it. Still getting error..

Get Original Text (Swift 3)

Hello. I'm trying to access the original text from AKMaskField (ex: '2016/11/11' would be '20161111'). I tried to follow your solution, but it didn't work.

var template: String = ""
for block in self.field.maskObject {
    template += block.template
}

println("Template text: \(template)")

First I couldn't access field.maskObject and block.template.
I looked into your code and changed fileprivate(set) var maskBlocks: [AKMaskFieldBlock] = [AKMaskFieldBlock]() to open var maskBlocks: [AKMaskFieldBlock] = [AKMaskFieldBlock]() and the same to template, so I could access it.

However, the print is always the value of maskTemplate, so I want to know if you could provide a new solution.

Thanks for your attention.

Swift 4.1

Good library, but too many warning under Swift 4.1. All of them about deprecated. Can you make new version?

Crash on method Refresh()

Original Code

    func refresh() {

        if maskObject.count > 0 && maskText != text {
            text = maskShowTemplate ? maskText : maskStatus == .Clear ? "" : maskText
        }

        // Reset manual updating property flag
        flagUpdateEvent = true
    }

The object maskObject was missing the Optional symbol(?) because it can be nil
Solution

    func refresh() {

        if maskObject?.count > 0 && maskText != text {
            text = maskShowTemplate ? maskText : maskStatus == .Clear ? "" : maskText
        }

        // Reset manual updating property flag
        flagUpdateEvent = true
    }

Manual install

According to the instructions... but not so much. There is obviously some other step here as I did this and importing doesn't find the file. There are some steps here that are missing. Can anyone provide more detail on how to get a manual install to work. Do we put in separate schema or put in the app's schema. Can't tell. Either way it doesn't seem to recognize the import AKMaskField statement and find it's way to this code.

Manual

If you prefer not to use either of the aforementioned dependency managers, you can integrate AKMaskField into your project manually.

Download and drop AKMaskField folder in your project.
Done!

Challenge getting mask to work.

I am receiving an error "Use of undeclared type 'AKMaskField'" i swift on a project I am working on. I have downloaded the project and copied it to my project folder. any ideas of challenge?

Cant find the text in MaskBlock

Hi, im trying to find the text attribute in MaskBlock, but the only thing i find is how many characters are in that block. I need to know what are these characters.

textFieldDidChange not working

Hi help me

didChanged not working ?

@IBOutlet weak var cep: AKMaskField!
cell?.cep.addTarget(self, action: #selector(textFieldDidChange(textField:)), for: .editingChanged)
func textFieldDidChange(textField: UITextField){ print(textField.text)}

Label text cannot be cleaned

Hello,

I try

@IBOutlet weak var myField: AKMaskField!

func cleanText(){
    myField.text = ""
}

The old value is cleared but after new insert the old value show up again, please help me.

maskDelegate is inaccessible

Hi I try to trigger the .ValueChanged on AKMaskField but as soon as i set maskExpression the event is not trigger anymore. therefore i tried to set the delegate and i have this error

'maskDelegate' is inaccessible due to 'internal' protection level

valueField.maskDelegate = self
valueField.text = value

I use the swift3 branch.

Thanks,
Have a good day.

AKMaskField was deallocated while key value observers were still registered with it.

Hello,

When navigationController?.popViewControllerAnimated(true) runs, error occurs. How can I fix it? I think it occurs because of manual updating part but I need that part.

Thanks

Error:
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'An instance 0x7f81104aafc0 of class MyMobileProject.AKMaskField was deallocated while key value observers were still registered with it. Current observation info: <NSKeyValueObservationInfo 0x7f811292c560> (
<NSKeyValueObservance 0x7f8112925510: Observer: 0x7f81104aafc0, Key path: text, Options: <New: NO, Old: NO, Prior: NO> Context: 0x0, Property: 0x7f8112924000>

Return text of maskField

Hello! I can't get text for my maskField.

I have code:

func maskField(maskField: AKMaskField, didChangedWithEvent event: AKMaskFieldEvent) {
    if maskField.maskStatus == .Complete {
        print(maskField.text)
    }
}

And I have mask "{dddd} {dddd} {dddd} {dddd}" and mask template "x".
I type numbers and on filling complete I have the string with template symbol at the end of string.
For example if my input is "1111 1111 1111 1111" maskField.text returns "1111 1111 111x". How can I get the full text?

Swift 3 xCode 8.3.2 Does not launch Simulator

Downloaded App. When I open the sample project and then build to run untouched the simulator does not load or run for this app. What's missing or needs to be changed. Would like to use this code but hard to eval if the sample code is not working.

Crashes on setting a placeholder without a mask

fatal error: unexpectedly found nil while unwrapping an Optional value

  * frame #1: AKMaskField.moveCarret(self=0x000000010e24de00) -> () + 320 at AKMaskField.swift:369
    frame #2: AKMaskField.refreshMask(self=0x000000010e24de00) -> () + 980 at AKMaskField.swift:238
    frame #3: AKMaskField.placeholder.didset(oldValue=some, self=0x000000010e24de00) + 96 at AKMaskField.swift:277
    frame #4: AKMaskField.placeholder.setter(newValue="ММ / ГГГГ", self=0x000000010e24de00) + 540 at AKMaskField.swift:0
    frame #5: CustomDateField. ...(closure #1) + 120 at CustomDateField.swift:28

The problem is pretty clear,
There are no maskBlocks here:

        switch maskStatus {
        case .clear       : position = maskBlocks.first!.templateRange.location

Variable size fields

I have a field which support two number sequences separated by a - char.

The first sequence can hold 4 or 5 numbers, and the second one can only have one number (0-9).

There is some way to make this mask with AKMaskField?

Thanks in advance!

Swift 4

This lib will be updated to swift 4 ?

Update status

how can update status if i set text programmaticaly?

Clear button not clearing through blocks

Hey there,

I have a mask like this: {ddddd}-{ddd} and the template is like this 00000-000, If the field is clear and I type 5 numbers it will automatically go to the second block of 3 numbers so I can normally keep typing, the thing is, If I'm pressing the "backspace" button to clear the field it won't go to the previous block of numbers! the cursur gets stuck after the "-", is there a way to fix this?

Swift 5

Do you think update the pod 4.0, 4.2 or 5.0?

Question

Are you still maintaining this framework?

crash on backspace all chars

private func moveCaretToPosition(position: Int) {

    if let beginningOfDocument: UITextPosition = beginningOfDocument {

        let caretPosition = positionFromPosition(beginningOfDocument, offset: position)
        selectedTextRange  = textRangeFromPosition(caretPosition!, toPosition: caretPosition!)
    }
}

was changed for

if let caretPosition = positionFromPosition(beginningOfDocument, offset: position){
selectedTextRange = textRangeFromPosition(caretPosition, toPosition: caretPosition)
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.