在现阶段的通信服务中,各种标准都有,因此会出现无法实现相互连通,而XMPP(Extensible Message and presence Protocol)协议的出现,实现了整个及时通信服务协议的互通。有了这个协议之后,使用任何一个组织或者个人提供的即使通信服务,都能够无障碍的 ...
在现阶段的通信服务中,各种标准都有,因此会出现无法实现相互连通,而XMPP(Extensible Message and presence Protocol)协议的出现,实现了整个及时通信服务协议的互通。有了这个协议之后,使用任何一个组织或者个人提供的即使通信服务,都能够无障碍的与其他的及时通信服务的用户进行交流。例如google 公司2005年推出的Google talk就是一款基于XMPP协议的即时通信软件。在前面的系列博文中,我们介绍了XMPP的详细使用(查看系列文章:http://www.cnblogs.com/jerehedu/p/4607599.html#xmpp),下面我们就谈论一下如何简单的使用XMPP的键盘订制:
1、首先增加键盘的自定义小图标和弹出效果
效果图如下:
#pragma mark - 排列按钮- (void) setUpSubviews{ //1 初始化图片名称 NSArray* array=@[@"compose_camerabutton_background_os7",@"compose_toolbar_picture_os7",@"compose_mentionbutton_background_os7",@"compose_trendbutton_background_os7",@"compose_emoticonbutton_background_os7"]; //2 排列按钮 CGFloat space=(kWidth-kMargin*2-kItemNum*kItemWidth)/(kItemNum-1)+kItemWidth; for (int i=0; i<kItemNum; i++) { UIButton * button=[UIButton buttonWithType:UIButtonTypeCustom]; button.tag=i; button.frame=CGRectMake(kMargin+i*space, self.frame.size.height/2.0-kItemHeight/2.0, kItemWidth, kItemHeight); // button.backgroundColor=JRRandomColor(); [button setBackgroundImage:[UIImage imageNamed:array[i]] forState:UIControlStateNormal]; //Actions 按钮事件 [button addTarget:self action:@selector(btClick:) forControlEvents:UIControlEventTouchUpInside]; [self addSubview:button]; } }/增加键盘事件弹出通知监控 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyUp:) name:UIKeyboardWillShowNotification object:nil]; //增加键盘事件消失通知监控[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyDown:) name:UIKeyboardWillHideNotification object:nil];#pragma mark - 键盘升起来- (void) keyUp:(NSNotification *) notification{ //获取动画的时间 CGFloat animaTime=[notification.userInfo[UIKeyboardAnimationDurationUserInfoKey] floatValue]; //获取键盘的尺寸(用来确定动画的范围) CGRect frame=[notification.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue]; //控制键盘动画 [UIView animateWithDuration:animaTime animations:^{ self.keyAccess.transform=CGAffineTransformMakeTranslation(0, frame.size.height*-1); }]; }#pragma mark - 键盘落下去- (void) keyDown:(NSNotification *) notification{ //获取动画的时间 CGFloat animaTime=[notification.userInfo[UIKeyboardAnimationDurationUserInfoKey] floatValue]; [UIView animateWithDuration:animaTime animations:^{ self.keyAccess.transform=CGAffineTransformIdentity; }]; }
海外公司注册、海外银行开户、跨境平台代入驻、VAT、EPR等知识和在线办理:https://www.xlkjsw.com
原标题:XMPP键盘订制实现图文混排
关键词:
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们:
admin#shaoqun.com
(#换成@)。