emoji的问题 iOS编程里 ios emoji这种问题甚是奇怪呀 求大神看看你们怎么怎么解决的? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 编码格式是utf8么? //是否包含emoji类型表情- (BOOL)isContainsEmoji:(NSString *)string { __block BOOL isEomji = NO; [string enumerateSubstringsInRange:NSMakeRange(0, [string length]) options:NSStringEnumerationByComposedCharacterSequences usingBlock: ^(NSString *substring, NSRange substringRange, NSRange enclosingRange, BOOL *stop) { const unichar hs = [substring characterAtIndex:0]; if (0xd800 <= hs && hs <= 0xdbff) { if (substring.length > 1) { const unichar ls = [substring characterAtIndex:1]; const int uc = ((hs - 0xd800) * 0x400) + (ls - 0xdc00) + 0x10000; if (0x1d000 <= uc && uc <= 0x1f77f) { isEomji = YES; } } } else if (substring.length > 1) { const unichar ls = [substring characterAtIndex:1]; if (ls == 0x20e3) { isEomji = YES; } } else { if (0x2100 <= hs && hs <= 0x27ff && hs != 0x263b) { isEomji = YES; } else if (0x2B05 <= hs && hs <= 0x2b07) { isEomji = YES; } else if (0x2934 <= hs && hs <= 0x2935) { isEomji = YES; } else if (0x3297 <= hs && hs <= 0x3299) { isEomji = YES; } else if (hs == 0xa9 || hs == 0xae || hs == 0x303d || hs == 0x3030 || hs == 0x2b55 || hs == 0x2b1c || hs == 0x2b1b || hs == 0x2b50|| hs == 0x231a ) { isEomji = YES; } } }]; return isEomji;}- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString*)string{ NSLog(@"[[UITextInputMode currentInputMode]primaryLanguage] is %@",[[UITextInputMode currentInputMode] primaryLanguage] ); if ([[[UITextInputMode currentInputMode] primaryLanguage] isEqualToString:@"emoji"]) { return NO; //只能屏蔽emoji键盘的输入,不能屏蔽拼音键盘输入emoji表情 } return YES;} - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString*)string{ NSLog(@"[[UITextInputMode currentInputMode]primaryLanguage] is %@",[[UITextInputMode currentInputMode] primaryLanguage] ); if ([[[UITextInputMode currentInputMode] primaryLanguage] isEqualToString:@"emoji"]) { return NO; //只能屏蔽emoji键盘的输入,不能屏蔽拼音键盘输入emoji表情 } return YES;} 苹果的Iphone开发适合个人做吗? 关于viewport 这样的一个应用程序该怎样设计,是否有例子? 工作的程序员怎么看移动互联网呢? 新手求介绍ios开发视屏教程 ios 重写 回调 请问有什么办法,可以让显示的gif文件,过5秒消失吗? OPENAL的播放速度 请问锁屏的情况下,如何让定时器能够起作用 ios 关于websocket问题 没事的可以进来看看 phoneGap ios上传文件进度条不显示 IOS 导航栏隐藏失效!!
//是否包含emoji类型表情
- (BOOL)isContainsEmoji:(NSString *)string {
__block BOOL isEomji = NO; [string enumerateSubstringsInRange:NSMakeRange(0, [string length]) options:NSStringEnumerationByComposedCharacterSequences usingBlock:
^(NSString *substring, NSRange substringRange, NSRange enclosingRange, BOOL *stop) {
const unichar hs = [substring characterAtIndex:0];
if (0xd800 <= hs && hs <= 0xdbff) {
if (substring.length > 1) {
const unichar ls = [substring characterAtIndex:1];
const int uc = ((hs - 0xd800) * 0x400) + (ls - 0xdc00) + 0x10000;
if (0x1d000 <= uc && uc <= 0x1f77f) {
isEomji = YES;
}
}
} else if (substring.length > 1) {
const unichar ls = [substring characterAtIndex:1];
if (ls == 0x20e3) {
isEomji = YES;
}
} else {
if (0x2100 <= hs && hs <= 0x27ff && hs != 0x263b) {
isEomji = YES;
} else if (0x2B05 <= hs && hs <= 0x2b07) {
isEomji = YES;
} else if (0x2934 <= hs && hs <= 0x2935) {
isEomji = YES;
} else if (0x3297 <= hs && hs <= 0x3299) {
isEomji = YES;
} else if (hs == 0xa9 || hs == 0xae || hs == 0x303d || hs == 0x3030 || hs == 0x2b55 || hs == 0x2b1c || hs == 0x2b1b || hs == 0x2b50|| hs == 0x231a ) {
isEomji = YES;
}
}
}];
return isEomji;
}- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString*)string{ NSLog(@"[[UITextInputMode currentInputMode]primaryLanguage] is %@",[[UITextInputMode currentInputMode] primaryLanguage] ); if ([[[UITextInputMode currentInputMode] primaryLanguage] isEqualToString:@"emoji"]) { return NO; //只能屏蔽emoji键盘的输入,不能屏蔽拼音键盘输入emoji表情
}
return YES;
}
}
return YES;
}