I'm doing something wrong with the range (I think) in setting this NSMutableAttributedString
. Can anyone tell me why this is crashing my program? It looks right to me, but I'm obviously wrong! Thanks.
NSString *placeHolderString = @"USERNAME";
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] init];
float spacing = 5.0f;
// crashes on this line
[attributedString addAttribute:NSKernAttributeName
value:@(spacing)
range:NSMakeRange(0, [placeHolderString length])];
self.userNameTextField.attributedPlaceholder = attributedString;