0

I'm trying to get a sample QuickDialog running via JSON. I current have:

{
    "grouped": true,
    "title": "Hello World",
    "controllerName": "MySampleController",
    "sections":
    [
        { "title":"Question:", "elements":
            [
                { "type":"QLabelElement", "title":"Hello", "value":"world!"},
                { "type":"QEntryElement", "key":"login",  "bind":"textValue:username", "title":"Login"},
                { "type":"QEntryElement", "key":"password",  "bind":"textValue:password", "title":"Password"}
            ]
        }
    ]
}

Which displays a label, username and password input. I would like to make the password input secure, but I have been unable to figure out how to do that via JSON.

I have tried adding the following element:

"secureTextEntry":"yes" but I get an exception:

[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key secureTextInput.'
*** First throw call stack:

Any suggestions on how I could get this working properly via QuickDialog's JSON implementation?

Community
  • 1
  • 1
Kyle
  • 17,317
  • 32
  • 140
  • 246
  • Hello, is the console referencing the class name that is not compliant for the key secureTextEntry – Daddy Jul 29 '13 at 19:23

2 Answers2

0

I submit this answer by another StackOverflow member:

Why does valueForKey: on a UITextField throws an exception for UITextInputTraits properties?

There are some properties of UITextField that are not KVC Compliant.

In that question there is another person who has swizzled UITextField to allow a workaround.

Community
  • 1
  • 1
Daddy
  • 9,045
  • 7
  • 69
  • 98
  • I appreciate the answer, but I'm really looking to see if there is an existing way in the QuickDialog framework to get this running. They have the json loading routine, so I'm assuming that i'm overlooking a way of setting the property properly. – Kyle Jul 30 '13 at 10:19
  • Do you have access to the .m file for QEntryElement? – Daddy Jul 30 '13 at 12:41
0

Maybe it is not a genuine way to use code like I am using. But you can modify

QEntryElement.h and QEntryElement.m files according to your requirement.

Remove this self.secureTextEntry = NO; line from - (QEntryElement *)init in QEntryElement.m file.

enter image description here

I modified the entry element file and got securetext entry.

enter image description here

See my modified method, maybe this could help you:

- (QEntryElement *)initWithTitle:(NSString *)title Value:(NSString *)value Placeholder:(NSString *)placeholder andSecureTextEntry:(BOOL)_secured{
    self = [self init];
    if (self) {
        _title = title;
        _textValue = value;
        _placeholder = placeholder;
        self.secureTextEntry=_secured;
    }
    return self;
}

in QEntryElement.h and m files.

Jim Simson
  • 2,774
  • 3
  • 22
  • 30
Prince Kumar Sharma
  • 12,591
  • 4
  • 59
  • 90