該源碼是語音分享應用源碼,本demo使用了科大訊飛語音識別作為分享內容的輸入方式,同時也支持手動鍵盤輸入分享內容,限制分享內容文字不能超過180個字符,分享內容輸入完成后可以直接分享,分享SDK使用的時友盟社會化分享。
- (IBAction)voiceRecognize:(id)sender {
    [self.textView resignFirstResponder];
     
    _result = @"";
     
    [_iflyRecognizerView start];
}
- (void)onResult:(NSArray *)resultArray isLast:(BOOL)isLast
{
    NSDictionary *dic = [resultArray objectAtIndex:0];
    NSMutableString *result = [NSMutableString new];
    NSLog(@"DIC:%@",dic);
    for (NSString *key in dic) {
        [result appendFormat:@"%@",key];
    }
    NSLog(@"result:%@",result);
     
    _result = [NSString stringWithFormat:@"%@%@",_result,result];
     
    if (isLast) {
        if (_result == nil||[_result isEqualToString:@""]) {
            UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"無法識別,請再說一遍" message:nil delegate:nil cancelButtonTitle:@"確定" otherButtonTitles:nil];
            [alert show];
        }else{
            self.textView.text = _result;
        }
    }
}
源碼項目下載:http://code.662p.com/view/9125.html
預覽圖:




新聞熱點
疑難解答