antiraum / THPinViewController

iOS 7 Style PIN Screen for iPhone and iPad

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cancel button always has white text

mreynolds0404 opened this issue · comments

In a previous version, the text of the cancel button label would follow whatever color was set as promptColor, now it is always white, which is a problem when using a white background. Sample code:

THPinViewController *pinViewController = [[THPinViewController alloc] initWithDelegate:self];

pinViewController.disableCancel = NO;
pinViewController.promptTitle = title;
UIColor *darkBlueColor = [UIColor colorWithRed:0.012f green:0.071f blue:0.365f alpha:1.0f];
pinViewController.promptColor = darkBlueColor;
pinViewController.view.tintColor = darkBlueColor;
pinViewController.backgroundColor = [UIColor whiteColor];


[self presentViewController:pinViewController animated:animated completion:nil];

//cancel button not visible

If it helps, I tried this as well with no luck:

[self presentViewController:pinViewController animated:animated completion:^{
//work around for styling bug in PIN controller library
id maybeCancelButton = pinViewController.view.subviews[0].subviews[3];

    if([maybeCancelButton isKindOfClass:[UIButton class]]){
        UIButton* cancelButton = (UIButton*)maybeCancelButton;
        cancelButton.titleLabel.textColor = darkBlueColor;
        cancelButton.titleLabel.tintColor = darkBlueColor;
    }

}];

@mreynolds0404 , this fixes title color

[cancelButton setTitleColor: darkBlueColor forState:UIControlStateNormal];

Any news on this, cancel (bottomButton) cannot be seen on default layout as it is white.