myuiwindow.m
来自「针对于Communication通信中间件的客户端程序。」· M 代码 · 共 49 行
M
49 行
#import "MyUIWindow.h"@implementation MyUIWindow- (IBAction)sendMsg:(id)sender { NSString* nstrMsgId = @"register"; NSString* nstrMsgBody = oTextSend.text; // package message CommuClientAppDelegate* delegate = [[UIApplication sharedApplication] delegate]; iMsg* msg = [delegate->_communicate bundleMsgWithMsgId:nstrMsgId Dest:nil Body:nstrMsgBody]; [delegate->_communicate sendMsgToServer:msg];}- (IBAction)sendToAnotherClient:(id)sender{ NSString* nstrMsgId = @"TextChat"; NSString* nstrMsgDest = @"Erin"; NSString* nstrMsgBody = oTextSend.text; // package message CommuClientAppDelegate* delegate = [[UIApplication sharedApplication] delegate]; iMsg* msg = [delegate->_communicate bundleMsgWithMsgId:nstrMsgId Dest:nstrMsgDest Body:nstrMsgBody]; [delegate->_communicate sendMsgToServer:msg];}- (void)becomeKeyWindow{ oTextRecv.text = @""; oTextSend.text = @"";}- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ // Dismiss the keyboard when the view outside the text field is touched. [oTextSend resignFirstResponder]; [oTextRecv resignFirstResponder]; // Revert the text field to the previous value. [super touchesBegan:touches withEvent:event];}- (void)recvRegisterReply:(iMsg*)msg{ [oTextRecv setText:msg->_msgBody];}- (void)recvTextChat:(iMsg*)msg{ [oTextRecv setText:msg->_msgBody];}@end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?