0
回答
编程开启iOS emoji

emoji是日本人(建议不要买日本的产品,支持国产,恨死日本男人了,哈哈)开发的一字符编码集,在iOS中集成了该字符集。 可以通过编程的方式激活emoji。

首先判断是否支持emoji:

- (BOOL)supportEmoji
{
	BOOL hasEmoji = NO;
#define kPreferencesPlistPath @"/private/var/mobile/Library/Preferences/com.apple.Preferences.plist"
	NSDictionary *plistDict = [[NSDictionary alloc] initWithContentsOfFile:kPreferencesPlistPath];
	NSNumber *emojiValue = [plistDict objectForKey:@"KeyboardEmojiEverywhere"];
	if (emojiValue)		//value might not exist yet
		hasEmoji = YES;
	else
		hasEmoji = NO;
	[plistDict release];
	
	return hasEmoji;
}

开启或关闭该功能:

- (void)valueControl:(BOOL)open
{
	
#define kPreferencesPlistPath @"/private/var/mobile/Library/Preferences/com.apple.Preferences.plist"
	NSMutableDictionary* plistDict = [[NSMutableDictionary alloc] initWithContentsOfFile:kPreferencesPlistPath];
	[plistDict setValue:[NSNumber numberWithBool:open] forKey:@"KeyboardEmojiEverywhere"];
	[plistDict writeToFile:kPreferencesPlistPath atomically:NO];
	[plistDict release];
}

如果你想看效果,除了调用上面方法:[self valueControl:YES]外,还得开启emoji键盘,方法如下:

Go to Settings > General > International > Keyboards > Japanese and enable the Emoji keyboard.


原文链接:http://blog.csdn.net/favormm/article/details/6774899
<无标签>
举报
长平狐
发帖于6年前 0回/547阅
顶部