I am using a textfield with phone number. The copy paste is enable in Textfield. The textfield should not take non numeric value.
But the problem is that if paste any String i takes non numeric value.
I have tried below code but not getting success:
- (BOOL)canPerformAction:(SEL)action withSender:(id)sender
{
if (action == @selector(paste:))
{
UIPasteboard *pasteboard =[UIPasteboard generalPasteboard];
NSLog(@"%@",pasteboard.string);
if ([self isAllDigits:pasteboard.string]) {
return YES;
}
return NO;
}
return [super canPerformAction:action withSender:sender];
}