|
|
@@ -38,6 +38,7 @@
|
|
|
#import "DaylightPopupView.h"
|
|
|
#import "ExternHeatPopupView.h"
|
|
|
|
|
|
+//규칙이름
|
|
|
@implementation RulesAddTitleTableViewCell
|
|
|
|
|
|
#pragma mark - textfield delegate
|
|
|
@@ -60,43 +61,116 @@
|
|
|
|
|
|
@end
|
|
|
|
|
|
-@implementation RulesAddHeaderTableViewCell
|
|
|
|
|
|
-@end
|
|
|
+//알림 메시지
|
|
|
+@interface RulesAddTextTableViewCell() <UITextViewDelegate>
|
|
|
|
|
|
+@property (nonatomic, strong) void (^heightChangeBlock)(CGFloat height) ;
|
|
|
|
|
|
-@implementation RulesAddTableViewCell
|
|
|
+@property (weak, nonatomic) IBOutlet NSLayoutConstraint *constTxtHeight;
|
|
|
+@property CGRect previousRect;
|
|
|
|
|
|
@end
|
|
|
|
|
|
+@implementation RulesAddTextTableViewCell
|
|
|
|
|
|
-@implementation RulesAddPushTableViewCell
|
|
|
+- (void)awakeFromNib {
|
|
|
+ [super awakeFromNib];
|
|
|
+
|
|
|
+ _previousRect = CGRectZero;
|
|
|
+ _previousRect.origin.y = 11.f;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+- (void)registHeightChangeBlock:(void (^)(CGFloat height)) heightChangeBlock {
|
|
|
+
|
|
|
+ _heightChangeBlock = heightChangeBlock ;
|
|
|
+}
|
|
|
+
|
|
|
+- (void)invokeChangeHeight:(CGFloat)height {
|
|
|
+
|
|
|
+ if( _heightChangeBlock != nil )
|
|
|
+ _heightChangeBlock(height) ;
|
|
|
+}
|
|
|
|
|
|
+#pragma mark - textView delegate
|
|
|
+- (void)textViewDidChange:(UITextView *)textView {
|
|
|
+
|
|
|
+ UITextPosition* pos = _txtView.endOfDocument;
|
|
|
+ CGRect currentRect = [_txtView caretRectForPosition:pos];
|
|
|
+ CGFloat previousY = _previousRect.origin.y;
|
|
|
+
|
|
|
+
|
|
|
+ if (previousY != currentRect.origin.y) {
|
|
|
+
|
|
|
+ CGFloat height = currentRect.origin.y - previousY;
|
|
|
+
|
|
|
+ _constTxtHeight.constant = _constTxtHeight.constant + height < 48.f ? 48.f : _constTxtHeight.constant + height;
|
|
|
+ [self invokeChangeHeight:height];
|
|
|
+ }
|
|
|
+
|
|
|
+ _previousRect = currentRect;
|
|
|
+}
|
|
|
+
|
|
|
+- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text{
|
|
|
+
|
|
|
+ NSString *string = [textView.text stringByReplacingCharactersInRange:range withString:text];
|
|
|
+
|
|
|
+ BOOL input = string.length == 0;
|
|
|
+
|
|
|
+ _btnConfirm.hidden = input;
|
|
|
+ _btnAdd.hidden = !input;
|
|
|
+
|
|
|
+ return YES;
|
|
|
+}
|
|
|
+
|
|
|
+- (void)textViewDidBeginEditing:(UITextView *)textView {
|
|
|
+
|
|
|
+ _imgTxtBg.highlighted = YES;
|
|
|
+}
|
|
|
+
|
|
|
+- (void)textViewDidEndEditing:(UITextView *)textView {
|
|
|
+
|
|
|
+ _imgTxtBg.highlighted = NO;
|
|
|
+}
|
|
|
|
|
|
@end
|
|
|
|
|
|
-@implementation RulesAddConditionHeaderTableViewCell
|
|
|
|
|
|
|
|
|
+@implementation RulesAddHeaderTableViewCell
|
|
|
@end
|
|
|
|
|
|
-@implementation RulesAddConditionTableViewCell
|
|
|
+@implementation RulesAddTableViewCell
|
|
|
+@end
|
|
|
|
|
|
+@implementation RulesAddPushTableViewCell
|
|
|
+@end
|
|
|
|
|
|
+@implementation RulesAddConditionHeaderTableViewCell
|
|
|
@end
|
|
|
|
|
|
-@implementation RulesAddFooterTableViewCell
|
|
|
+@implementation RulesAddConditionTableViewCell
|
|
|
+@end
|
|
|
|
|
|
+@implementation RulesAddFooterTableViewCell
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
|
|
-@interface RulesAddViewController () <CustomTextViewDelegate, UITextFieldDelegate> {
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+@interface RulesAddViewController () <KeyboardFrameChangedDelegate> {
|
|
|
+
|
|
|
|
|
|
NSMutableArray<ItemModel> *_triggerDevices, *_actionDevices, *_conditionDevices;
|
|
|
|
|
|
BOOL _isNotFirstLoading, _hasCondition;
|
|
|
NSMutableArray *_arrayForHeader, *_arrayForFooter;
|
|
|
+ CGFloat textCellChangeHeight; //알림 메세지 셀 사이즈 변동
|
|
|
+
|
|
|
|
|
|
CustomTextField *_txtRuleTitle;
|
|
|
CustomTextView *_txvMessage;
|
|
|
@@ -106,8 +180,12 @@
|
|
|
|
|
|
RulesConditionHomeModePopupView *_mpopup;
|
|
|
RulesConditionViewController *_rcv;
|
|
|
+
|
|
|
+ __weak IBOutlet NSLayoutConstraint *constTableBottom;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
+
|
|
|
@property (strong, nonatomic) NSMutableArray<ItemModel> *triggers;
|
|
|
@property (strong, nonatomic) NSMutableArray<ItemModel> *actions;
|
|
|
@property (strong, nonatomic) NSMutableArray<ItemModel> *conditions;
|
|
|
@@ -126,58 +204,44 @@
|
|
|
[self prepareViewDidLoad];
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-- (void)cloneSubItemsForItemSubType:(NSArray<ItemModel> *)items {
|
|
|
+- (void)viewWillAppear:(BOOL)animated {
|
|
|
+ [super viewWillAppear:animated];
|
|
|
|
|
|
- for (ItemModel *item in items) {
|
|
|
- if ([item.itemSubTypeCode isEqualToString:ksItemSubTypeCodeDevice]) {//디바이스일 경우,
|
|
|
- //기존 아이템을 그대로 사용함.
|
|
|
- for (ItemSubModel *subItem in item.subItems) {
|
|
|
- [[JDFacade facade] setRadioButtonStatus:@YES object:subItem];
|
|
|
- [[JDFacade facade] setCheckBoxStatus:@YES object:subItem];
|
|
|
- }
|
|
|
- } else if ([item.itemSubTypeCode isEqualToString:ksItemSubTypeCodeAppPush]) {//푸시일 경우,
|
|
|
- item.pushes = (NSMutableArray<ItemSubModel> *)[[NSMutableArray alloc] initWithArray:item.subItems copyItems:YES];
|
|
|
- item.subItems = nil;
|
|
|
-
|
|
|
- } else if ([item.itemSubTypeCode isEqualToString:ksItemSubTypeCodeTimer]) {//타이머일 경우,
|
|
|
- item.timers = (NSMutableArray<ItemSubModel> *)[[NSMutableArray alloc] initWithArray:item.subItems copyItems:YES];
|
|
|
- item.subItems = nil;
|
|
|
- } else if ([item.itemSubTypeCode isEqualToString:ksItemSubTypeCodeDaylight]) {//해뜰때/질때 경우,
|
|
|
- item.daylights = (NSMutableArray<ItemSubModel> *)[[NSMutableArray alloc] initWithArray:item.subItems copyItems:YES];
|
|
|
- item.subItems = nil;
|
|
|
- } else if ([item.itemSubTypeCode isEqualToString:ksItemSubTypeCodeHeat]) {//더울때/추울때 경우,
|
|
|
- item.heats = (NSMutableArray<ItemSubModel> *)[[NSMutableArray alloc] initWithArray:item.subItems copyItems:YES];
|
|
|
- item.subItems = nil;
|
|
|
- } else if ([item.itemSubTypeCode isEqualToString:ksItemSubTypeCodeMode]) {//더울때/추울때 경우,
|
|
|
- //기존 아이템을 그대로 사용함.
|
|
|
- }
|
|
|
- }
|
|
|
+ [self addObserverKeyboardFrameChanged:self] ;
|
|
|
}
|
|
|
|
|
|
-- (void)setRefRuleDetail:(RuleDetailModel *)refRuleDetail {
|
|
|
-
|
|
|
-
|
|
|
- _refRuleDetail = refRuleDetail;
|
|
|
+- (void)viewWillDisappear:(BOOL)animated {
|
|
|
+ [self viewWillDisappear:animated];
|
|
|
|
|
|
- _triggers = (NSMutableArray<ItemModel> *)[[NSMutableArray alloc] initWithArray:_refRuleDetail.triggers copyItems:YES];
|
|
|
- _actions = (NSMutableArray<ItemModel> *)[[NSMutableArray alloc] initWithArray:_refRuleDetail.actions copyItems:YES];
|
|
|
- _conditions = (NSMutableArray<ItemModel> *)[[NSMutableArray alloc] initWithArray:_refRuleDetail.conditions copyItems:YES];
|
|
|
+ [self removeObserverKeyboard] ;
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark - Keyboard Frame Changed Delegate
|
|
|
+- (void)keyboardFrameChanged:(CGRect)frame duration:(CGFloat)duration display:(BOOL)display {
|
|
|
|
|
|
- [self cloneSubItemsForItemSubType:_triggers];
|
|
|
- [self cloneSubItemsForItemSubType:_actions];
|
|
|
- [self cloneSubItemsForItemSubType:_conditions];
|
|
|
+ NSLog(@"call keyboardFrameChanged!!");
|
|
|
|
|
|
- _hasCondition = [_conditions objectKey:@"itemSubTypeCode" eqaulToString:ksConditionSubTypeCodeHomeMode];
|
|
|
- _hasCondition = [_conditions objectKey:@"itemSubTypeCode" eqaulToString:ksConditionSubTypeCodeDueDate] ? YES : _hasCondition;
|
|
|
- _hasCondition = [_conditions objectKey:@"itemSubTypeCode" eqaulToString:ksItemSubTypeCodeDevice] ? YES : _hasCondition;
|
|
|
+ [UIView animateWithDuration:duration animations:^{
|
|
|
+
|
|
|
+ if( display ) {
|
|
|
+ constTableBottom.constant = frame.size.height;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ constTableBottom.constant = 50.0f;
|
|
|
+ }
|
|
|
+
|
|
|
+ [self.view layoutIfNeeded];
|
|
|
+
|
|
|
+ }] ;
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+#pragma mark - init
|
|
|
- (void)initProperties {
|
|
|
_arrayForHeader = [[NSMutableArray alloc] init];
|
|
|
_arrayForFooter = [[NSMutableArray alloc] init];
|
|
|
-
|
|
|
+
|
|
|
if (!_triggers) {
|
|
|
_triggers = (NSMutableArray<ItemModel> *)[[NSMutableArray alloc] init];
|
|
|
}
|
|
|
@@ -192,9 +256,9 @@
|
|
|
|
|
|
|
|
|
- (void)initUI {
|
|
|
-
|
|
|
+
|
|
|
[self initTableViewAsDefaultStyle:_tableView];
|
|
|
-
|
|
|
+
|
|
|
if (_refRuleDetail) {
|
|
|
_lblTitle.text = @"규칙 편집";
|
|
|
}
|
|
|
@@ -207,6 +271,7 @@
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
#pragma mark - Main Logic
|
|
|
- (void)requestDeviceListForAction:(NSString *)typeCode {
|
|
|
//parameters
|
|
|
@@ -391,6 +456,7 @@
|
|
|
}];
|
|
|
}
|
|
|
|
|
|
+
|
|
|
//아이템 배열을 리턴함.
|
|
|
- (NSArray *)items:(NSArray<ItemModel> *)items {
|
|
|
|
|
|
@@ -549,6 +615,55 @@
|
|
|
return rConditions;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+- (void)cloneSubItemsForItemSubType:(NSArray<ItemModel> *)items {
|
|
|
+
|
|
|
+ for (ItemModel *item in items) {
|
|
|
+ if ([item.itemSubTypeCode isEqualToString:ksItemSubTypeCodeDevice]) {//디바이스일 경우,
|
|
|
+ //기존 아이템을 그대로 사용함.
|
|
|
+ for (ItemSubModel *subItem in item.subItems) {
|
|
|
+ [[JDFacade facade] setRadioButtonStatus:@YES object:subItem];
|
|
|
+ [[JDFacade facade] setCheckBoxStatus:@YES object:subItem];
|
|
|
+ }
|
|
|
+ } else if ([item.itemSubTypeCode isEqualToString:ksItemSubTypeCodeAppPush]) {//푸시일 경우,
|
|
|
+ item.pushes = (NSMutableArray<ItemSubModel> *)[[NSMutableArray alloc] initWithArray:item.subItems copyItems:YES];
|
|
|
+ item.subItems = nil;
|
|
|
+
|
|
|
+ } else if ([item.itemSubTypeCode isEqualToString:ksItemSubTypeCodeTimer]) {//타이머일 경우,
|
|
|
+ item.timers = (NSMutableArray<ItemSubModel> *)[[NSMutableArray alloc] initWithArray:item.subItems copyItems:YES];
|
|
|
+ item.subItems = nil;
|
|
|
+ } else if ([item.itemSubTypeCode isEqualToString:ksItemSubTypeCodeDaylight]) {//해뜰때/질때 경우,
|
|
|
+ item.daylights = (NSMutableArray<ItemSubModel> *)[[NSMutableArray alloc] initWithArray:item.subItems copyItems:YES];
|
|
|
+ item.subItems = nil;
|
|
|
+ } else if ([item.itemSubTypeCode isEqualToString:ksItemSubTypeCodeHeat]) {//더울때/추울때 경우,
|
|
|
+ item.heats = (NSMutableArray<ItemSubModel> *)[[NSMutableArray alloc] initWithArray:item.subItems copyItems:YES];
|
|
|
+ item.subItems = nil;
|
|
|
+ } else if ([item.itemSubTypeCode isEqualToString:ksItemSubTypeCodeMode]) {//더울때/추울때 경우,
|
|
|
+ //기존 아이템을 그대로 사용함.
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+- (void)setRefRuleDetail:(RuleDetailModel *)refRuleDetail {
|
|
|
+
|
|
|
+
|
|
|
+ _refRuleDetail = refRuleDetail;
|
|
|
+
|
|
|
+ _triggers = (NSMutableArray<ItemModel> *)[[NSMutableArray alloc] initWithArray:_refRuleDetail.triggers copyItems:YES];
|
|
|
+ _actions = (NSMutableArray<ItemModel> *)[[NSMutableArray alloc] initWithArray:_refRuleDetail.actions copyItems:YES];
|
|
|
+ _conditions = (NSMutableArray<ItemModel> *)[[NSMutableArray alloc] initWithArray:_refRuleDetail.conditions copyItems:YES];
|
|
|
+
|
|
|
+ [self cloneSubItemsForItemSubType:_triggers];
|
|
|
+ [self cloneSubItemsForItemSubType:_actions];
|
|
|
+ [self cloneSubItemsForItemSubType:_conditions];
|
|
|
+
|
|
|
+ _hasCondition = [_conditions objectKey:@"itemSubTypeCode" eqaulToString:ksConditionSubTypeCodeHomeMode];
|
|
|
+ _hasCondition = [_conditions objectKey:@"itemSubTypeCode" eqaulToString:ksConditionSubTypeCodeDueDate] ? YES : _hasCondition;
|
|
|
+ _hasCondition = [_conditions objectKey:@"itemSubTypeCode" eqaulToString:ksItemSubTypeCodeDevice] ? YES : _hasCondition;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
#pragma mark - UITableView DataSource & Delegate
|
|
|
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
|
|
|
return 5;
|
|
|
@@ -568,8 +683,7 @@
|
|
|
count = deviceItem.subItems && deviceItem.subItems.count ? deviceItem.subItems.count : 0;
|
|
|
|
|
|
} else if (section == 3) {//push-message
|
|
|
- ItemModel *pushItem = [_actions objectKey:@"itemSubTypeCode" eqaulToString:ksItemSubTypeCodeAppPush];
|
|
|
- count = pushItem.pushes && pushItem.pushes.count ? pushItem.pushes.count : 0;
|
|
|
+ count = 1;
|
|
|
|
|
|
} else if (section == 4) {//conditions
|
|
|
count = _chkConditions.checked || _hasCondition ? 1 : 0;
|
|
|
@@ -600,9 +714,6 @@
|
|
|
} else if (section == 2) {//action
|
|
|
title = @"동작할 장치";
|
|
|
// title = _actions && _actions.count ? @"선택됨" : title;
|
|
|
- } else if (section == 3) {//pushes
|
|
|
- title = @"알림 메시지";
|
|
|
-// title = _pushes && _pushes.count ? @"선택됨" : title;
|
|
|
}
|
|
|
|
|
|
// else if (section == 3) {//conditions
|
|
|
@@ -623,9 +734,6 @@
|
|
|
} else if (section == 2) {
|
|
|
[btnAdd addTarget:self action:@selector(btnAddActionTouched:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
|
|
|
- } else if (section == 3) {
|
|
|
- _btnPushAdd = btnAdd;
|
|
|
- [btnAdd addTarget:self action:@selector(btnAddPushMessageTouched:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -635,9 +743,9 @@
|
|
|
UIView *view = _arrayForHeader.count > section ? _arrayForHeader[section] : nil;
|
|
|
|
|
|
if (!view) {
|
|
|
- if (section == 0) {//title
|
|
|
+ if (section == 0 || section == 3) {//title
|
|
|
view = [[UIView alloc] init];
|
|
|
- } else if (section == 1 || section == 2 || section == 3) {//hide add button or not;
|
|
|
+ } else if (section == 1 || section == 2) {//hide add button or not;
|
|
|
|
|
|
RulesAddHeaderTableViewCell *hcell = (RulesAddHeaderTableViewCell *)[tableView dequeueReusableCellWithIdentifier:@"HeaderCellIdentifier"];
|
|
|
hcell.width = IPHONE_WIDTH;
|
|
|
@@ -646,6 +754,7 @@
|
|
|
[view addSubview:hcell];
|
|
|
|
|
|
hcell.lblTitle.text = [self headerTitleForSection:section];
|
|
|
+ hcell.imgBg.hidden = section % 2 == 0;
|
|
|
|
|
|
if (![hcell.btnAdd actionsForTarget:self forControlEvent:UIControlEventTouchUpInside]) {
|
|
|
[self addTargetToHeaderAddButton:hcell.btnAdd section:section];
|
|
|
@@ -680,7 +789,7 @@
|
|
|
}
|
|
|
} else {
|
|
|
|
|
|
- if (section == 1 || section == 2 || section == 3) {
|
|
|
+ if (section == 1 || section == 2) {
|
|
|
RulesAddHeaderTableViewCell *hcell = (RulesAddHeaderTableViewCell *)view.subviews[0];
|
|
|
hcell.lblTitle.text = hcell.lblTitle.text = [self headerTitleForSection:section];
|
|
|
|
|
|
@@ -698,11 +807,7 @@
|
|
|
|
|
|
if (section == 1) {
|
|
|
_btnTriggerAdd.hidden = self.triggers.count > 0;
|
|
|
- } else if (section == 3) {
|
|
|
- ItemModel *pushItem = [_actions objectKey:@"itemSubTypeCode" eqaulToString:ksItemSubTypeCodeAppPush];
|
|
|
- NSInteger pcount = pushItem.pushes && pushItem.pushes.count ? pushItem.pushes.count : 0;
|
|
|
- _btnPushAdd.hidden = pcount > 0;
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- (void)chkConditionsTouched:(id)sender {
|
|
|
@@ -745,16 +850,18 @@
|
|
|
}
|
|
|
|
|
|
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
|
|
|
- if (section == 0) {
|
|
|
+
|
|
|
+ if (section == 0 || section == 3) {
|
|
|
return 0.01f;
|
|
|
- } else if (section == 4) {
|
|
|
+ }
|
|
|
+ else if (section == 4) {
|
|
|
return 56.0f;
|
|
|
}
|
|
|
+
|
|
|
return 56.0f;
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
|
|
|
|
|
|
UIView *view = _arrayForFooter.count > section ? _arrayForFooter[section] : nil;
|
|
|
@@ -796,7 +903,7 @@
|
|
|
|
|
|
} else if (section == 3) {//push-message
|
|
|
// height = UITableViewAutomaticDimension;
|
|
|
- height = 123;
|
|
|
+ height = 122 + textCellChangeHeight;
|
|
|
|
|
|
} else if (section == 4) {//conditions
|
|
|
if (!_rcv) {
|
|
|
@@ -947,8 +1054,7 @@
|
|
|
_txtRuleTitle = tcell.txtRuleTitle;
|
|
|
}
|
|
|
|
|
|
- tcell.btnDelete.hidden = YES;
|
|
|
- tcell.btnConfirm.hidden = YES;
|
|
|
+ [self insertActionAddButton:tcell.btnAdd];
|
|
|
|
|
|
cell = tcell;
|
|
|
|
|
|
@@ -962,6 +1068,7 @@
|
|
|
tcell.lblItem.textColor = kUITextColor04;
|
|
|
|
|
|
tcell.btnDelete.value = item;
|
|
|
+
|
|
|
if (![tcell.btnDelete actionsForTarget:self forControlEvent:UIControlEventTouchUpInside]) {
|
|
|
[tcell.btnDelete addTarget:self action:@selector(btnDeleteTriggerTouched:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
}
|
|
|
@@ -1010,20 +1117,22 @@
|
|
|
ItemModel *pushItem = [_actions objectKey:@"itemSubTypeCode" eqaulToString:ksItemSubTypeCodeAppPush];
|
|
|
ItemSubModel *subItem = pushItem.pushes[indexPath.row];
|
|
|
|
|
|
- RulesAddPushTableViewCell *tcell = (RulesAddPushTableViewCell *)[_tableView dequeueReusableCellWithIdentifier:@"PushCellIdentifier"];
|
|
|
+ RulesAddTextTableViewCell *tcell = (RulesAddTextTableViewCell *)[_tableView dequeueReusableCellWithIdentifier:@"TextCellIdentifier"];
|
|
|
+
|
|
|
+ //높이변경
|
|
|
+ [tcell registHeightChangeBlock:^(CGFloat height) {
|
|
|
+ textCellChangeHeight += height;
|
|
|
+ [self tableView:_tableView reloadRowWhileShowingKeyboard:indexPath];
|
|
|
+ }];
|
|
|
+
|
|
|
if (!_txvMessage) {
|
|
|
- _txvMessage = tcell.txvMessage;
|
|
|
+ _txvMessage = tcell.txtView;
|
|
|
}
|
|
|
-// [self textViewDidChange:tcell.txvMessage];
|
|
|
|
|
|
- _txvMessage.delegate = self;
|
|
|
_txvMessage.text = [_txvMessage.text isEqualToString:_txvMessage.placeHolder] && _refRuleDetail ? subItem.cmdclsValue : _txvMessage.text;
|
|
|
-
|
|
|
- tcell.btnDelete.value = subItem;
|
|
|
- [tcell.btnDelete addTarget:self action:@selector(btnDeletePushActionTouched:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
-
|
|
|
- tcell.btnConfirm.hidden = YES;
|
|
|
-
|
|
|
+
|
|
|
+ [self insertActionAddButton:tcell.btnAdd];
|
|
|
+
|
|
|
cell = tcell;
|
|
|
|
|
|
} else if (section == 4) {//conditions
|
|
|
@@ -1051,6 +1160,15 @@
|
|
|
return cell;
|
|
|
}
|
|
|
|
|
|
+//키보드 유지 셀 높이 변경
|
|
|
+- (void)tableView:(UITableView *)tableView reloadRowWhileShowingKeyboard:(NSIndexPath *)indexPath {
|
|
|
+
|
|
|
+ [tableView beginUpdates];
|
|
|
+ [tableView endUpdates];
|
|
|
+
|
|
|
+ [tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionMiddle animated:YES];
|
|
|
+}
|
|
|
+
|
|
|
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
|
[tableView deselectRowAtIndexPath:indexPath animated:YES];
|
|
|
|
|
|
@@ -1080,6 +1198,8 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+#pragma mark
|
|
|
- (void)modifyTriggerOfTimer:(ItemModel *)item {
|
|
|
|
|
|
TimePickerPopupView *tpopup = [[TimePickerPopupView alloc] initFromNib];
|
|
|
@@ -1193,9 +1313,8 @@
|
|
|
}];
|
|
|
}
|
|
|
|
|
|
-#pragma mark - TableView UI Events
|
|
|
-
|
|
|
|
|
|
+#pragma mark - TableView UI Events
|
|
|
- (void)btnAddTriggerTouched:(id)sender {
|
|
|
|
|
|
TriggerSelectPopupView *tpopup = [[TriggerSelectPopupView alloc] initFromNib];
|
|
|
@@ -1322,14 +1441,57 @@
|
|
|
|
|
|
}
|
|
|
|
|
|
+- (void)btnAddTouched:(id)sender {
|
|
|
|
|
|
-#pragma mark - CustomTextView Delegate
|
|
|
+ UIButton *btn = sender;
|
|
|
+
|
|
|
+ //1001:규칙add, 2001:알림add
|
|
|
+
|
|
|
+ UIControl *control;
|
|
|
+
|
|
|
+ if ([btn tag] > 2000) {
|
|
|
+
|
|
|
+ control = [self.view viewWithTag:2000];
|
|
|
+ }
|
|
|
+ else {
|
|
|
+
|
|
|
+ control = [self.view viewWithTag:1000];
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ [control becomeFirstResponder];
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+//- (void)btnInputConfirmTouched:(id)sender {
|
|
|
+//
|
|
|
+// UIButton *btn = sender;
|
|
|
+//
|
|
|
+// //1002:규칙add, 2002:알림add
|
|
|
+// if ([btn tag] > 2000) {
|
|
|
+//
|
|
|
+//
|
|
|
+// }
|
|
|
+// else {
|
|
|
+//
|
|
|
+// }
|
|
|
+//
|
|
|
+//}
|
|
|
|
|
|
-- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text {
|
|
|
- NSLog(@"%s\n %zd", __PRETTY_FUNCTION__, textView.text.length);
|
|
|
- return textView.text.length < 120;
|
|
|
+- (void)insertActionAddButton:(UIButton*)button {
|
|
|
+
|
|
|
+ if (![button actionsForTarget:self forControlEvent:UIControlEventTouchUpInside]) {
|
|
|
+ [button addTarget:self action:@selector(btnAddTouched:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+//- (void)insertActionInputConfirmButton:(UIButton*)button {
|
|
|
+//
|
|
|
+// if (![button actionsForTarget:self forControlEvent:UIControlEventTouchUpInside]) {
|
|
|
+// [button addTarget:self action:@selector(btnInputConfirmTouched:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+// }
|
|
|
+//}
|
|
|
+
|
|
|
|
|
|
|
|
|
|