Custom UI
With CocoaPod
You need to download CustomUIPaymentFormViewController.xib, unzip and add in your project.
Need to change the Nib Name when init the CustomUIPaymentFormViewController.
paymentForm = [[my2c2pPaymentFormViewController alloc] initWithNibName:@"CustomUIPaymentFormViewController" bundle:nil];
paymentForm = my2c2pPaymentFormViewController.init(nibName: "CustomUIPaymentFormViewController", bundle: nil)
Without CocoaPod
For customize the UI , you need to edit on CustomUIPaymentFormViewController.xib that include on my2c2pSDK folder.
Xib
It include views for the all the payment methods.
It already connected with IBOutlet and you can change the Button color and text color, etc.
Change the Navigation Bar Color
You can change the navigation bar color like following
//nav bar color
paymentForm.navBarColor = [UIColor colorWithRed:0.811 green:0.05 blue:0.078 alpha:1];
//nav button color
paymentForm.navButtonTintColor = [UIColor whiteColor];
//nav title color
paymentForm.navTitleColor = [UIColor whiteColor];
//nav title
paymentForm.navTitle = @"MyPayment";
//nav title image
paymentForm.navLogo = [UIImage imageNamed:@"logo.png"];
//nav bar color
paymentForm.navBarColor = UIColor(red: 0.811, green: 0.05, blue: 0.078, alpha: 1)
//nav button color
paymentForm.navButtonTintColor = UIColor.white
//nav title color
paymentForm.navTitleColor = UIColor.white
//nav title
paymentForm.navTitle = "MyPayment"
//nav title image
paymentForm.navLogo = UIImage(named: "logo.png")
Change The Button Design
To edit the button design, you need to add delegate.
Add the my2c2pPaymentFormViewControllerSourceDelegate
in class
@interface ViewController ()<my2c2pPaymentFormViewControllerSourceDelegate>
class ViewController: UIViewController , my2c2pPaymentFormViewControllerSourceDelegate
After allocate , set the delegateVC
paymentForm = [[my2c2pPaymentFormViewController alloc] initWithNibName:@"CustomUIPaymentFormViewController" bundle:nil];
paymentForm.delegateVC = self;
paymentForm = my2c2pPaymentFormViewController.init(nibName: "CustomUIPaymentFormViewController", bundle: nil)
paymentForm.delegateVC = self
Add paymentFormViewDidLoad
- (void)paymentFormViewDidLoad
{
//rounded corner
paymentForm.confirmbtn.layer.cornerRadius = 5;
paymentForm.storeCardConfirmbtn.layer.cornerRadius = 5;
paymentForm.whatIsCvvButton.layer.cornerRadius = 11;
paymentForm.storeCardWhatIsCvvButton.layer.cornerRadius = 11;
paymentForm.useNewCardBtn.layer.cornerRadius = 5;
//add border color for buttons
paymentForm.confirmbtn.layer.borderWidth = 1;
paymentForm.confirmbtn.layer.borderColor = [[UIColor grayColor] CGColor];
paymentForm.storeCardConfirmbtn.layer.borderWidth = 1;
paymentForm.storeCardConfirmbtn.layer.borderColor = [[UIColor grayColor] CGColor];
paymentForm.whatIsCvvButton.layer.borderWidth = 1;
paymentForm.whatIsCvvButton.layer.borderColor = [[UIColor grayColor] CGColor];
paymentForm.whatIsCvvButton.layer.masksToBounds = YES;
paymentForm.storeCardWhatIsCvvButton.layer.borderWidth = 1;
paymentForm.storeCardWhatIsCvvButton.layer.borderColor = [[UIColor grayColor] CGColor];
paymentForm.useNewCardBtn.layer.borderWidth = 1;
paymentForm.useNewCardBtn.layer.borderColor = [[UIColor grayColor] CGColor];
}
func paymentFormViewDidLoad() {
//rounded corner
paymentForm.confirmbtn!.layer.cornerRadius = 5
paymentForm.storeCardConfirmbtn!.layer.cornerRadius = 5
paymentForm.whatIsCvvButton!.layer.cornerRadius = 11
paymentForm.storeCardWhatIsCvvButton!.layer.cornerRadius = 11
paymentForm.useNewCardBtn!.layer.cornerRadius = 5
//add border color for buttons
paymentForm.confirmbtn!.layer.borderWidth = 1
paymentForm.confirmbtn!.layer.borderColor = UIColor.gray.cgColor
paymentForm.storeCardConfirmbtn!.layer.borderWidth = 1
paymentForm.storeCardConfirmbtn!.layer.borderColor = UIColor.gray.cgColor
paymentForm.whatIsCvvButton!.layer.borderWidth = 1
paymentForm.whatIsCvvButton!.layer.borderColor = UIColor.gray.cgColor
paymentForm.whatIsCvvButton!.layer.masksToBounds = true
paymentForm.storeCardWhatIsCvvButton!.layer.borderWidth = 1
paymentForm.storeCardWhatIsCvvButton!.layer.borderColor = UIColor.gray.cgColor
paymentForm.useNewCardBtn!.layer.borderWidth = 1
paymentForm.useNewCardBtn!.layer.borderColor = UIColor.gray.cgColor
}