Set delegate to your UITextField ivar. Set keyboardType property to UIKeyboardTypeNumberPad
Write this code.
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{
if ([string isEqualToString:@"-"]){
return NO;
}
return YES;
}