如何为ZipCode和三星Galaxy强制使用数字键盘?

时间:2015-04-24 14:56:37

标签: android ios html5

我已经阅读了stackoverflow上的几个答案,这些答案没有解决为Samsung Galaxy for Zip Code显示数字键盘的问题。

iOS会打开一个数字键盘,但三星Galaxy不会为这段代码调出数字键盘:

<input name="zipCode" type="text" pattern="\d*" required="required" title="Please enter a valid U.S. zip code">

HTML5号码输入类型无效,因为它会截断以零开头的邮政编码:

<input name="zipCode" type="number" required="required" min="0" title="Please enter a valid U.S. zip code">

这不适用于iOS或三星Galaxy,因为iOS会查找[0-9] *或\ d *作为模式:

<input name="zipCode" type="text" pattern="^\d{5}$" required="required" title="Please enter a valid U.S. zip code">

1 个答案:

答案 0 :(得分:0)

我相信电话号码可能有效。尝试:

NSError *error; // Recording settings NSDictionary *settings = @{AVEncoderAudioQualityKey: @(AVAudioQualityMedium), AVFormatIDKey: @(kAudioFormatMPEG4AAC), AVEncoderBitRateKey: @(128000), AVNumberOfChannelsKey: @(1), AVSampleRateKey: @(44100), AVLinearPCMBitDepthKey:@(8)}; // File URL NSURL *url = [NSURL fileURLWithPath:pathToSave];//FILEPATH]; // Create recorder recorder = [[AVAudioRecorder alloc] initWithURL:url settings:settings error:&error]; if (!recorder) { NSLog(@"Error establishing recorder: %@", error.localizedFailureReason); return NO; } recorder.delegate = delegate; recorder.meteringEnabled = YES; if (![recorder prepareToRecord]) { NSLog(@"Error: Prepare to record failed"); return NO; } if (![recorder record]) { NSLog(@"Error: Record failed"); return NO; }