It doesn't seem like PTKView has an address user interface component (though). However, they give you the type PTKAddressZip to check if the entered zip code is valid.
I created my own mail field, which looks exactly like the Credit card field, using the provided textField.png image that comes with PaymentKit.
Here it is, both in Objective-C examples and in Swift ...
OBJECTIVE-C:
UITextField *zipTextField; zipTextField = [[UITextField alloc] initWithFrame: CGRectMake(15,170,290,55)]; zipTextField.keyboardType = UIKeyboardTypeNumberPad; zipTextField.placeholder = @"ZIP Code";
SWIFT:
//Setup ZIP field self.zipTextField = UITextField(frame: CGRectMake(15,170,290,45)) self.zipTextField.keyboardType = UIKeyboardType.NumberPad self.zipTextField.placeholder = "ZIP Code" //Left padding var paddingView = UIView(frame:CGRectMake(0, 0, 5, 20)) self.zipTextField.leftView = paddingView self.zipTextField.leftViewMode = UITextFieldViewMode.Always //Make it look like the CC box var backgroundImageView = UIImageView(frame:self.zipTextField.bounds) backgroundImageView.image = UIImage(named: "textField") backgroundImageView.image = backgroundImageView.image?.resizableImageWithCapInsets(UIEdgeInsetsMake(0,8,0,8)) self.zipTextField.addSubview(backgroundImageView) //Validate the zip - Put this code in your Submit button self.view.addSubview(self.zipTextField) var zip = PTKAddressZip(string: "15227") NSLog( zip.isValid().description )
source share