...
|
...
|
@@ -10,7 +10,8 @@ |
|
|
#import "YH_BarrageTableView.h"
|
|
|
//#import "YH_YohoLoginViewModel.h"
|
|
|
//#import "M16HUDUtil.h"
|
|
|
|
|
|
#import "Macros.h"
|
|
|
#import "UIViewAdditions.h"
|
|
|
#define kBarrageTableViewHeight 253
|
|
|
#define kBarrageTableViewWidth (245 * kScreenPointScale)
|
|
|
#define kInputTextFieldHeight 34
|
...
|
...
|
@@ -84,52 +85,52 @@ |
|
|
|
|
|
- (void)setBottomView
|
|
|
{
|
|
|
// CGFloat scalePoint = SCREEN_HEIGHT / 667.0;
|
|
|
//
|
|
|
// [self.barrageTableView setFrame:CGRectMake(0, CGRectGetHeight(self.view.bounds)-kBarrageTableViewHeight * scalePoint-kInputTextFieldBottomEdge, kBarrageTableViewWidth, kBarrageTableViewHeight * scalePoint)];
|
|
|
//
|
|
|
// self.bottomContainerView = [[UIView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(self.barrageTableView.frame) + 5, SCREEN_WIDTH, kInputTextFieldHeight)];
|
|
|
// self.bottomContainerView.backgroundColor = [UIColor clearColor];
|
|
|
// [self.inputTextField setFrame:CGRectMake(kPaddingLeft, 0, CGRectGetWidth(self.view.bounds) - 2*kPaddingLeft, kInputTextFieldHeight)];
|
|
|
//
|
|
|
// self.inputTextBgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.view.bounds) - 2*kPaddingLeft, kInputTextFieldHeight)];
|
|
|
// self.inputTextBgView.image = [UIImage imageNamed:@"inputTextBg"];
|
|
|
// [self.inputTextField addSubview:self.inputTextBgView];
|
|
|
// [self.inputTextField sendSubviewToBack:self.inputTextBgView];
|
|
|
// [self.bottomContainerView addSubview:self.inputTextField];
|
|
|
// [self.bottomContainerView bringSubviewToFront:self.inputTextField];
|
|
|
//
|
|
|
// self.closeButtonContainer = [[UIView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH - 2*kPaddingLeft- kCloseButtonWidth, 0, kCloseButtonWidth + 2*kPaddingLeft, kInputTextFieldHeight)];
|
|
|
// self.closeButtonContainer.centerY = self.inputTextField.centerY;
|
|
|
// UITapGestureRecognizer *closeGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(closeKeyBoard:)];
|
|
|
// [self.closeButtonContainer addGestureRecognizer:closeGesture];
|
|
|
// self.closeButtonContainer.userInteractionEnabled = YES;
|
|
|
// self.closeButtonContainer.hidden = YES;
|
|
|
// self.keyBoardCloseButton = [[UIButton alloc] initWithFrame:CGRectMake(kPaddingLeft, 0, kCloseButtonWidth, kCloseButtonWidth)];
|
|
|
// [self.keyBoardCloseButton setImage:[UIImage imageNamed:@"keyBoardClose"] forState:UIControlStateNormal];
|
|
|
// self.keyBoardCloseButton.userInteractionEnabled = NO;
|
|
|
// self.keyBoardCloseButton.centerY = self.inputTextField.centerY;
|
|
|
// [self.closeButtonContainer addSubview:self.keyBoardCloseButton];
|
|
|
// [self.bottomContainerView addSubview:self.closeButtonContainer];
|
|
|
//
|
|
|
// [self.view addSubview:self.bottomContainerView];
|
|
|
//
|
|
|
// self.messageTip = [[UIImageView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH - kMessageTipWidth - kMessageTipLeftEdge, self.barrageTableView.bottom - 5 - kMessageTipHeight, kMessageTipWidth, kMessageTipHeight)];
|
|
|
// self.messageTip.image = [UIImage imageNamed:@"message_Tip"];
|
|
|
// self.messageTip.userInteractionEnabled = YES;
|
|
|
// UITapGestureRecognizer *tapGR = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(newsBubbleClick:)];
|
|
|
// tapGR.numberOfTapsRequired = 1;
|
|
|
// [self.messageTip addGestureRecognizer:tapGR];
|
|
|
//
|
|
|
// self.messageArrow = [[UIImageView alloc] initWithFrame:CGRectMake(10, 7, 10, 8)];
|
|
|
// self.messageArrow.image = [UIImage imageNamed:@"messageArrow"];
|
|
|
// [self.messageTip addSubview:self.messageArrow];
|
|
|
//
|
|
|
// [self.newsBubble setFrame:CGRectMake(CGRectGetMaxX(self.messageArrow.frame) + 5, 0, kMessageTipWidth - CGRectGetMaxX(self.messageArrow.frame) - 10, kMessageTipHeight)];
|
|
|
// [self.messageTip addSubview:self.newsBubble];
|
|
|
// self.messageTip.hidden = YES;
|
|
|
//
|
|
|
// [self.view addSubview:self.messageTip];
|
|
|
CGFloat scalePoint = SCREEN_HEIGHT / 667.0;
|
|
|
|
|
|
[self.barrageTableView setFrame:CGRectMake(0, CGRectGetHeight(self.view.bounds)-kBarrageTableViewHeight * scalePoint-kInputTextFieldBottomEdge, kBarrageTableViewWidth, kBarrageTableViewHeight * scalePoint)];
|
|
|
|
|
|
self.bottomContainerView = [[UIView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(self.barrageTableView.frame) + 5, SCREEN_WIDTH, kInputTextFieldHeight)];
|
|
|
self.bottomContainerView.backgroundColor = [UIColor clearColor];
|
|
|
[self.inputTextField setFrame:CGRectMake(kPaddingLeft, 0, CGRectGetWidth(self.view.bounds) - 2*kPaddingLeft, kInputTextFieldHeight)];
|
|
|
|
|
|
self.inputTextBgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.view.bounds) - 2*kPaddingLeft, kInputTextFieldHeight)];
|
|
|
self.inputTextBgView.image = [UIImage imageNamed:@"inputTextBg"];
|
|
|
[self.inputTextField addSubview:self.inputTextBgView];
|
|
|
[self.inputTextField sendSubviewToBack:self.inputTextBgView];
|
|
|
[self.bottomContainerView addSubview:self.inputTextField];
|
|
|
[self.bottomContainerView bringSubviewToFront:self.inputTextField];
|
|
|
|
|
|
self.closeButtonContainer = [[UIView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH - 2*kPaddingLeft- kCloseButtonWidth, 0, kCloseButtonWidth + 2*kPaddingLeft, kInputTextFieldHeight)];
|
|
|
self.closeButtonContainer.centerY = self.inputTextField.centerY;
|
|
|
UITapGestureRecognizer *closeGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(closeKeyBoard:)];
|
|
|
[self.closeButtonContainer addGestureRecognizer:closeGesture];
|
|
|
self.closeButtonContainer.userInteractionEnabled = YES;
|
|
|
self.closeButtonContainer.hidden = YES;
|
|
|
self.keyBoardCloseButton = [[UIButton alloc] initWithFrame:CGRectMake(kPaddingLeft, 0, kCloseButtonWidth, kCloseButtonWidth)];
|
|
|
[self.keyBoardCloseButton setImage:[UIImage imageNamed:@"keyBoardClose"] forState:UIControlStateNormal];
|
|
|
self.keyBoardCloseButton.userInteractionEnabled = NO;
|
|
|
self.keyBoardCloseButton.centerY = self.inputTextField.centerY;
|
|
|
[self.closeButtonContainer addSubview:self.keyBoardCloseButton];
|
|
|
[self.bottomContainerView addSubview:self.closeButtonContainer];
|
|
|
|
|
|
[self.view addSubview:self.bottomContainerView];
|
|
|
|
|
|
self.messageTip = [[UIImageView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH - kMessageTipWidth - kMessageTipLeftEdge, self.barrageTableView.bottom - 5 - kMessageTipHeight, kMessageTipWidth, kMessageTipHeight)];
|
|
|
self.messageTip.image = [UIImage imageNamed:@"message_Tip"];
|
|
|
self.messageTip.userInteractionEnabled = YES;
|
|
|
UITapGestureRecognizer *tapGR = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(newsBubbleClick:)];
|
|
|
tapGR.numberOfTapsRequired = 1;
|
|
|
[self.messageTip addGestureRecognizer:tapGR];
|
|
|
|
|
|
self.messageArrow = [[UIImageView alloc] initWithFrame:CGRectMake(10, 7, 10, 8)];
|
|
|
self.messageArrow.image = [UIImage imageNamed:@"messageArrow"];
|
|
|
[self.messageTip addSubview:self.messageArrow];
|
|
|
|
|
|
[self.newsBubble setFrame:CGRectMake(CGRectGetMaxX(self.messageArrow.frame) + 5, 0, kMessageTipWidth - CGRectGetMaxX(self.messageArrow.frame) - 10, kMessageTipHeight)];
|
|
|
[self.messageTip addSubview:self.newsBubble];
|
|
|
self.messageTip.hidden = YES;
|
|
|
|
|
|
[self.view addSubview:self.messageTip];
|
|
|
}
|
|
|
|
|
|
-(void)closeKeyBoard:(UIButton *)sender
|
...
|
...
|
@@ -232,38 +233,17 @@ |
|
|
#pragma mark - HPGrowingTextViewDelegate
|
|
|
- (BOOL)growingTextView:(HPGrowingTextView *)growingTextView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
|
|
|
{
|
|
|
// if ([text isEqualToString:@"\n"]) {
|
|
|
// if (![self.inputTextField.text isEqualToString:@""]) {
|
|
|
// if ([GVUserDefaults standardUserDefaults].userLogged) {
|
|
|
// [self.inputTextField resignFirstResponder];
|
|
|
// if (self.sendMsgBlock) {
|
|
|
// self.sendMsgBlock(self.inputTextField.text);
|
|
|
// }
|
|
|
// self.inputTextField.text = @"";
|
|
|
// return YES;
|
|
|
// } else {
|
|
|
// __weak typeof(self) weakSelf = self;
|
|
|
// [self.inputTextField resignFirstResponder];
|
|
|
// [[YH_YohoLoginViewModel loginMgr] excuteBlockRequireHasLogin:^{
|
|
|
// __strong typeof(weakSelf) strongSelf = weakSelf;
|
|
|
// if (strongSelf.sendMsgBlock) {
|
|
|
// strongSelf.sendMsgBlock(self.inputTextField.text);
|
|
|
// }
|
|
|
//
|
|
|
// if (strongSelf.loginToTCPServerBlock) {
|
|
|
// strongSelf.loginToTCPServerBlock();
|
|
|
// }
|
|
|
// strongSelf.inputTextField.text = @"";
|
|
|
// }];
|
|
|
// return YES;
|
|
|
// }
|
|
|
// }else {
|
|
|
// return NO;
|
|
|
// }
|
|
|
// }else if (range.location >= 30) {
|
|
|
// [self showText:@"内容不可以超过30个字"];
|
|
|
// return NO;
|
|
|
// }
|
|
|
if ([text isEqualToString:@"\n"]) {
|
|
|
if (![self.inputTextField.text isEqualToString:@""]) {
|
|
|
|
|
|
return YES;
|
|
|
}else {
|
|
|
return NO;
|
|
|
}
|
|
|
}else if (range.location >= 30) {
|
|
|
[self showText:@"内容不可以超过30个字"];
|
|
|
return NO;
|
|
|
}
|
|
|
return YES;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -322,7 +302,7 @@ |
|
|
|
|
|
- (void)showText:(NSString *)text
|
|
|
{
|
|
|
// if ([text notNilOrEmpty]) {
|
|
|
// if (text.length) {
|
|
|
// [M16HUDUtil textOnly:text inView:self.view];
|
|
|
// }
|
|
|
}
|
...
|
...
|
|