iOS7.1
用于Secure Text Fields
的点比以前的点大,而且非常难看。
我可以使用different icon
代替这些标准点吗?如果是这样,我该怎么做?
答案 0 :(得分:0)
您可以尝试以下代码:
/* don't ever use this PROOF OF CONCEPT CODE for production use */
-(BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
if ( self.backing == nil ) self.backing = @"";
static BOOL pasting = false;
if ( !pasting )
{
self.backing = [self.backing stringByReplacingCharactersInRange:range withString:string];
NSLog(@"backing: %@",self.backing);
if ( [string length] == 0 ) return YES; // early bail out when just deleting chars
NSString *sec = @"";
for ( int i=0;i<[string length]; i++ ) sec = [sec stringByAppendingFormat:@"■"];
pasting = true;
[[UIPasteboard generalPasteboard] setString:sec];
[textField paste:self];
return NO;
} else {
pasting = false;
return YES;
}
}