Răsfoiți Sursa

1.修改iOS Apex Mobile Detail Communication键盘事件。

Pen Li 8 ani în urmă
părinte
comite
06878db0b5

+ 9 - 0
Apex Mobile/Apex Mobile/AMCommContentCell.m

@@ -45,6 +45,15 @@
     self.timeLabel.text = _time;
     self.timeLabel.text = _time;
 }
 }
 
 
+- (void)setEmail:(NSString *)email {
+    _email = email;
+    if (_email && _email.length > 0) {
+        self.emailButton.hidden = NO;
+    } else {
+        self.emailButton.hidden = YES;
+    }
+}
+
 - (IBAction)emailButtonClick:(UIButton *)sender {
 - (IBAction)emailButtonClick:(UIButton *)sender {
     
     
     if (self.delegate && [self.delegate respondsToSelector:@selector(commContentCell:sendEmail:)]) {
     if (self.delegate && [self.delegate respondsToSelector:@selector(commContentCell:sendEmail:)]) {

+ 2 - 2
Apex Mobile/Apex Mobile/AMCommContentCell.xib

@@ -25,10 +25,10 @@
                         <nil key="textColor"/>
                         <nil key="textColor"/>
                         <nil key="highlightedColor"/>
                         <nil key="highlightedColor"/>
                     </label>
                     </label>
-                    <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" editable="NO" textAlignment="natural" translatesAutoresizingMaskIntoConstraints="NO" id="6uJ-NL-4aw">
+                    <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" bounces="NO" scrollEnabled="NO" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" bouncesZoom="NO" editable="NO" textAlignment="natural" translatesAutoresizingMaskIntoConstraints="NO" id="6uJ-NL-4aw">
                         <rect key="frame" x="5" y="31" width="548" height="163.5"/>
                         <rect key="frame" x="5" y="31" width="548" height="163.5"/>
                         <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                         <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
-                        <mutableString key="text">Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda.</mutableString>
+                        <string key="text">Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda.</string>
                         <fontDescription key="fontDescription" type="system" pointSize="14"/>
                         <fontDescription key="fontDescription" type="system" pointSize="14"/>
                         <textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
                         <textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
                         <dataDetectorType key="dataDetectorTypes" link="YES" address="YES" calendarEvent="YES" shipmentTrackingNumber="YES" lookupSuggestion="YES"/>
                         <dataDetectorType key="dataDetectorTypes" link="YES" address="YES" calendarEvent="YES" shipmentTrackingNumber="YES" lookupSuggestion="YES"/>

+ 4 - 0
Apex Mobile/Apex Mobile/AMCommEditCell.h

@@ -14,6 +14,8 @@
 @optional
 @optional
 - (void)commEditCell:(AMCommEditCell *)cell clickToSendEmail:(NSString *)email;
 - (void)commEditCell:(AMCommEditCell *)cell clickToSendEmail:(NSString *)email;
 - (void)commEditCell:(AMCommEditCell *)cell didChangeEmail:(NSString *)email;
 - (void)commEditCell:(AMCommEditCell *)cell didChangeEmail:(NSString *)email;
+- (void)commEditCell:(AMCommEditCell *)cell didBeginEditing:(UITextView *)textView;
+- (void)commEditCell:(AMCommEditCell *)cell didEndEditing:(UITextView *)textView;
 
 
 @end
 @end
 
 
@@ -24,4 +26,6 @@
 
 
 - (void)clear;
 - (void)clear;
 
 
+- (CGFloat)heightForContent:(NSString *)content withTableWidth:(CGFloat)tableWidth;
+
 @end
 @end

+ 30 - 0
Apex Mobile/Apex Mobile/AMCommEditCell.m

@@ -21,6 +21,10 @@
     [super awakeFromNib];
     [super awakeFromNib];
     // Initialization code
     // Initialization code
     self.editTextView.delegate = self;
     self.editTextView.delegate = self;
+    
+    self.editTextView.layer.shadowOffset = CGSizeMake(1, 1);
+    self.editTextView.layer.borderColor = [UIColor lightGrayColor].CGColor;
+    self.editTextView.layer.borderWidth = 0.5f;
 }
 }
 
 
 - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
 - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
@@ -45,6 +49,18 @@
     self.email = nil;
     self.email = nil;
 }
 }
 
 
+- (CGFloat)heightForContent:(NSString *)content withTableWidth:(CGFloat)tableWidth {
+    if (content && content.length > 0) {
+        
+        self.editTextView.text = content;
+        CGSize size = [self.editTextView sizeThatFits:CGSizeMake(tableWidth - 11.0f, FLT_MAX)];
+        
+        return size.height + 1;
+    } else {
+        return 0.0f;
+    }
+}
+
 #pragma mark - TextView Delegate
 #pragma mark - TextView Delegate
 
 
 - (void)textViewDidChange:(UITextView *)textView {
 - (void)textViewDidChange:(UITextView *)textView {
@@ -54,4 +70,18 @@
     }
     }
 }
 }
 
 
+- (BOOL)textViewShouldBeginEditing:(UITextView *)textView {
+    if (self.delegate && [self.delegate respondsToSelector:@selector(commEditCell:didBeginEditing:)]) {
+        [self.delegate commEditCell:self didBeginEditing:textView];
+    }
+    return YES;
+}
+
+- (BOOL)textViewShouldEndEditing:(UITextView *)textView {
+    if (self.delegate && [self.delegate respondsToSelector:@selector(commEditCell:didEndEditing:)]) {
+        [self.delegate commEditCell:self didEndEditing:textView];
+    }
+    return YES;
+}
+
 @end
 @end

+ 6 - 6
Apex Mobile/Apex Mobile/AMCommEditCell.xib

@@ -12,22 +12,22 @@
     <objects>
     <objects>
         <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
         <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
         <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
         <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
-        <tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="200" id="KGk-i7-Jjw" customClass="AMCommEditCell">
-            <rect key="frame" x="0.0" y="0.0" width="619" height="200"/>
+        <tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="90" id="KGk-i7-Jjw" customClass="AMCommEditCell">
+            <rect key="frame" x="0.0" y="0.0" width="619" height="90"/>
             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
             <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
             <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
-                <rect key="frame" x="0.0" y="0.0" width="619" height="199.5"/>
+                <rect key="frame" x="0.0" y="0.0" width="619" height="89.5"/>
                 <autoresizingMask key="autoresizingMask"/>
                 <autoresizingMask key="autoresizingMask"/>
                 <subviews>
                 <subviews>
                     <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" textAlignment="natural" translatesAutoresizingMaskIntoConstraints="NO" id="1eU-dE-EuR">
                     <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" textAlignment="natural" translatesAutoresizingMaskIntoConstraints="NO" id="1eU-dE-EuR">
-                        <rect key="frame" x="5" y="5" width="609" height="149.5"/>
+                        <rect key="frame" x="5" y="5" width="609" height="40"/>
                         <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                         <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
-                        <string key="text">Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda.</string>
+                        <string key="text">Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis </string>
                         <fontDescription key="fontDescription" type="system" pointSize="14"/>
                         <fontDescription key="fontDescription" type="system" pointSize="14"/>
                         <textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
                         <textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
                     </textView>
                     </textView>
                     <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="eNH-NS-zAQ">
                     <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="eNH-NS-zAQ">
-                        <rect key="frame" x="563" y="164.5" width="36" height="30"/>
+                        <rect key="frame" x="563" y="54.5" width="36" height="30"/>
                         <state key="normal" title="Send"/>
                         <state key="normal" title="Send"/>
                         <connections>
                         <connections>
                             <action selector="sendButtonClick:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="nxc-oe-5PO"/>
                             <action selector="sendButtonClick:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="nxc-oe-5PO"/>

+ 2 - 0
Apex Mobile/Apex Mobile/AMCommHeadCell.h

@@ -13,6 +13,8 @@
 
 
 @optional
 @optional
 - (void)commHeadCell:(AMCommHeadCell *)cell didChangeCC:(NSString *)cc;
 - (void)commHeadCell:(AMCommHeadCell *)cell didChangeCC:(NSString *)cc;
+- (void)commHeadCell:(AMCommHeadCell *)cell didBeginEditing:(UITextField *)textField;
+- (void)commHeadCell:(AMCommHeadCell *)cell didEndEditing:(UITextField *)textField;
 
 
 @end
 @end
 
 

+ 18 - 0
Apex Mobile/Apex Mobile/AMCommHeadCell.m

@@ -54,4 +54,22 @@
     return YES;
     return YES;
 }
 }
 
 
+- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
+    
+    if (self.delegate && [self.delegate respondsToSelector:@selector(commHeadCell:didBeginEditing:)]) {
+        [self.delegate commHeadCell:self didBeginEditing:textField];
+    }
+    
+    return YES;
+}
+
+- (BOOL)textFieldShouldEndEditing:(UITextField *)textField {
+    
+    if (self.delegate && [self.delegate respondsToSelector:@selector(commHeadCell:didEndEditing:)]) {
+        [self.delegate commHeadCell:self didEndEditing:textField];
+    }
+    
+    return YES;
+}
+
 @end
 @end

+ 165 - 3
Apex Mobile/Apex Mobile/DetailPageViewController.m

@@ -123,6 +123,11 @@
 
 
 @property (nonatomic,strong) IBOutlet AMShipMap *shipMap;
 @property (nonatomic,strong) IBOutlet AMShipMap *shipMap;
 
 
+@property (nonatomic,weak) UITableViewCell *editingCell;
+@property (nonatomic,strong) NSIndexPath *editingIndexPath;
+@property (nonatomic,weak) UITapGestureRecognizer *tap;
+@property (nonatomic,assign) BOOL showKeyboard;
+
 @end
 @end
 
 
 @implementation DetailPageViewController
 @implementation DetailPageViewController
@@ -187,6 +192,19 @@
     [self configureTableView];
     [self configureTableView];
 }
 }
 
 
+- (void)viewWillAppear:(BOOL)animated {
+    [super viewWillAppear:animated];
+    NSString *action_type = [self.params objectForKey:@"action_type"];
+    if ([action_type isEqualToString:@"Detail"]) { // 避免Tap与Tacking中Cell点击冲突
+        [self startListenKeyboard];
+    }
+}
+
+- (void)viewWillDisappear:(BOOL)animated {
+    [super viewWillDisappear:animated];
+    [self stopListenKeyboard];
+}
+
 - (void)configureTableView {
 - (void)configureTableView {
     
     
     [self.table registerNib:[UINib nibWithNibName:@"AMCommHeadCell" bundle:nil] forCellReuseIdentifier:COMM_ID_HEAD];
     [self.table registerNib:[UINib nibWithNibName:@"AMCommHeadCell" bundle:nil] forCellReuseIdentifier:COMM_ID_HEAD];
@@ -766,11 +784,33 @@
 //        return height;
 //        return height;
     }
     }
     else if ([type isEqualToString:@"communication"]) {
     else if ([type isEqualToString:@"communication"]) {
-        NSInteger rowCount = [tableView numberOfRowsInSection:indexPath.section];
+        NSInteger rowCount = [self tableView:tableView numberOfRowsInSection:indexPath.section];
         if (indexPath.row == 0) {
         if (indexPath.row == 0) {
             return 133.0f;
             return 133.0f;
         } else if (indexPath.row == rowCount - 1) {
         } else if (indexPath.row == rowCount - 1) {
-            return 200.0f;
+            
+            NSMutableDictionary* segment = [self.content.segments[indexPath.section] mutableCopy];
+            NSString *edit_content = [segment objectForKey:@"edit_content"];
+            
+            CGFloat h = 40.0f; // 输入框高度,最小40
+            if (edit_content && edit_content.length > 0) {
+                
+                AMCommEditCell *cell = [[[NSBundle mainBundle] loadNibNamed:@"AMCommEditCell" owner:nil options:nil] objectAtIndex:0];
+                
+                h = [cell heightForContent:edit_content withTableWidth:CGRectGetWidth(tableView.bounds)];
+                
+                if (h < 40.0f) {
+                    h = 40.0f;
+                } else if (h > 100.0f) { // 输入框高度,最大100
+                    h = 100.0f;
+                }
+                
+                
+            } else {
+                h = 40.0f;
+            }
+            
+            return 50.0f + h;
         } else {
         } else {
             
             
             NSMutableDictionary* segment = [self.content.segments[indexPath.section] mutableCopy];
             NSMutableDictionary* segment = [self.content.segments[indexPath.section] mutableCopy];
@@ -1507,6 +1547,98 @@
     [self presentViewController:menuAlert animated:YES completion:nil];
     [self presentViewController:menuAlert animated:YES completion:nil];
 }
 }
 
 
+#pragma mark - Keyboard
+
+- (void)startListenKeyboard {
+    NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
+    // 键盘通知
+    [notificationCenter addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
+    [notificationCenter addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
+    [notificationCenter addObserver:self selector:@selector(keyboardChangeFrame:) name:UIKeyboardDidChangeFrameNotification object:nil];
+    
+    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapToHideKeyboard:)];
+    [self.view addGestureRecognizer:tap];
+    self.tap = tap;
+}
+
+- (void)stopListenKeyboard {
+    NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
+    [notificationCenter removeObserver:self];
+    
+    [self.view removeGestureRecognizer:self.tap];
+}
+
+- (void)tapToHideKeyboard:(UITapGestureRecognizer *)tap {
+    [self.view endEditing:YES];
+}
+
+/**键盘隐藏*/
+- (void)keyboardWillHide:(NSNotification *)notification {
+    NSLog(@"keyboard hide");
+    self.showKeyboard = NO;
+}
+
+/**键盘显示*/
+- (void)keyboardWillShow:(NSNotification *)notification {
+    
+//    NSTimeInterval duration = [[[notification userInfo] objectForKey:UIKeyboardAnimationDurationUserInfoKey] floatValue];
+//    CGRect begin = [[[notification userInfo] objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue];
+//    CGRect end = [[[notification userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
+//
+//    if (duration == 0) {
+//        duration = 0.25;
+//    }
+    NSLog(@"keyboard show");
+    self.showKeyboard = YES;
+}
+
+/**在使用过程中切换键盘*/
+- (void)keyboardChangeFrame:(NSNotification *)notification {
+    
+    NSLog(@"keyboard change frame");
+    
+    NSTimeInterval duration = [[[notification userInfo] objectForKey:UIKeyboardAnimationDurationUserInfoKey] floatValue];
+//    CGRect begin = [[[notification userInfo] objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue];
+    CGRect end = [[[notification userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
+    
+    if (duration == 0) {
+        duration = 0.25;
+    }
+    
+    NSLayoutConstraint *bottom_constraint = nil;
+    for (NSLayoutConstraint *constraint in self.view.constraints) {
+        if ([constraint.identifier isEqualToString:@"table_bottom_constraint"]) {
+            bottom_constraint = constraint;
+            break;
+        }
+    }
+    
+    CGFloat tabBarY = CGRectGetMinY(self.tabBarController.tabBar.frame);
+    
+    CGFloat offset = tabBarY - CGRectGetMinY(end);
+    if (offset < 0) {
+        offset = 0;
+    }
+    
+    if (bottom_constraint) {
+        bottom_constraint.constant = offset;
+        [self.view layoutIfNeeded];
+        
+        if (self.editingIndexPath) {
+            [self.table scrollToRowAtIndexPath:self.editingIndexPath atScrollPosition:UITableViewScrollPositionNone animated:UITableViewRowAnimationNone];
+        }
+    }
+    
+    CGSize contentSize = self.table.contentSize;
+    CGPoint contentOffset = self.table.contentOffset;
+    offset = contentOffset.y - (contentSize.height - CGRectGetHeight(self.table.bounds));
+    if (offset > 0) {
+        contentOffset.y -= offset;
+        self.table.contentOffset = contentOffset;
+    }
+    
+}
+
 #pragma mark - COMM Head Delegate
 #pragma mark - COMM Head Delegate
 
 
 - (void)commHeadCell:(AMCommHeadCell *)cell didChangeCC:(NSString *)cc {
 - (void)commHeadCell:(AMCommHeadCell *)cell didChangeCC:(NSString *)cc {
@@ -1525,6 +1657,16 @@
     self.content.segments = arr;
     self.content.segments = arr;
 }
 }
 
 
+- (void)commHeadCell:(AMCommHeadCell *)cell didBeginEditing:(UITextField *)textField {
+    self.editingCell = cell;
+    self.editingIndexPath = [self.table indexPathForCell:cell];
+}
+
+- (void)commHeadCell:(AMCommHeadCell *)cell didEndEditing:(UITextField *)textField {
+    self.editingCell = nil;
+    self.editingIndexPath = nil;
+}
+
 #pragma mark - COMM Content Delegate
 #pragma mark - COMM Content Delegate
 
 
 - (void)commContentCell:(AMCommContentCell *)cell sendEmail:(NSString *)email {
 - (void)commContentCell:(AMCommContentCell *)cell sendEmail:(NSString *)email {
@@ -1538,7 +1680,7 @@
 }
 }
 
 
 - (void)commEditCell:(AMCommEditCell *)cell didChangeEmail:(NSString *)email {
 - (void)commEditCell:(AMCommEditCell *)cell didChangeEmail:(NSString *)email {
-    
+    // 保存数据
     NSIndexPath *indexPath = [self.table indexPathForCell:cell];
     NSIndexPath *indexPath = [self.table indexPathForCell:cell];
     
     
     NSMutableDictionary* segment = [self.content.segments[indexPath.section] mutableCopy];
     NSMutableDictionary* segment = [self.content.segments[indexPath.section] mutableCopy];
@@ -1551,6 +1693,26 @@
     NSMutableArray *arr = [self.content.segments mutableCopy];
     NSMutableArray *arr = [self.content.segments mutableCopy];
     [arr replaceObjectAtIndex:indexPath.section withObject:segment];
     [arr replaceObjectAtIndex:indexPath.section withObject:segment];
     self.content.segments = arr;
     self.content.segments = arr;
+    
+    // 调用 tableView 的 beginUpdates 和 endUpdates,重新计算 cell 的高度
+    [self.table beginUpdates];
+    [self.table endUpdates];
+    
+    // 防止在输入的时候超出屏幕区域
+    CGRect frame = cell.frame;
+    if (CGRectGetMaxY(frame) > CGRectGetMaxY(self.table.bounds)) {
+        [self.table scrollRectToVisible:frame animated:NO];
+    }
+}
+
+- (void)commEditCell:(AMCommEditCell *)cell didBeginEditing:(UITextView *)textView {
+    self.editingCell = cell;
+    self.editingIndexPath = [self.table indexPathForCell:cell];
+}
+
+- (void)commEditCell:(AMCommEditCell *)cell didEndEditing:(UITextView *)textView {
+    self.editingCell = nil;
+    self.editingIndexPath = nil;
 }
 }
 
 
 @end
 @end

+ 1 - 1
Apex Mobile/Apex Mobile/Main.storyboard

@@ -1882,7 +1882,7 @@
                             <constraint firstAttribute="trailing" secondItem="9wT-8n-8NB" secondAttribute="trailing" id="Hi5-QQ-eXP"/>
                             <constraint firstAttribute="trailing" secondItem="9wT-8n-8NB" secondAttribute="trailing" id="Hi5-QQ-eXP"/>
                             <constraint firstItem="AKO-ni-aUG" firstAttribute="centerX" secondItem="Sml-Qx-H9e" secondAttribute="centerX" id="QUs-dy-CCo"/>
                             <constraint firstItem="AKO-ni-aUG" firstAttribute="centerX" secondItem="Sml-Qx-H9e" secondAttribute="centerX" id="QUs-dy-CCo"/>
                             <constraint firstItem="mia-XC-A8d" firstAttribute="top" secondItem="9wT-8n-8NB" secondAttribute="bottom" constant="2" identifier="top_constraint" id="TXm-fF-9tV"/>
                             <constraint firstItem="mia-XC-A8d" firstAttribute="top" secondItem="9wT-8n-8NB" secondAttribute="bottom" constant="2" identifier="top_constraint" id="TXm-fF-9tV"/>
-                            <constraint firstItem="WfC-yf-L95" firstAttribute="top" secondItem="mia-XC-A8d" secondAttribute="bottom" id="VgT-0V-bY6"/>
+                            <constraint firstItem="WfC-yf-L95" firstAttribute="top" secondItem="mia-XC-A8d" secondAttribute="bottom" identifier="table_bottom_constraint" id="VgT-0V-bY6"/>
                             <constraint firstItem="Cs2-5V-Ius" firstAttribute="centerY" secondItem="Sml-Qx-H9e" secondAttribute="centerY" id="b7w-Ch-uZo"/>
                             <constraint firstItem="Cs2-5V-Ius" firstAttribute="centerY" secondItem="Sml-Qx-H9e" secondAttribute="centerY" id="b7w-Ch-uZo"/>
                             <constraint firstItem="9wT-8n-8NB" firstAttribute="top" secondItem="gd4-2b-xmy" secondAttribute="bottom" id="bmD-bG-2QS"/>
                             <constraint firstItem="9wT-8n-8NB" firstAttribute="top" secondItem="gd4-2b-xmy" secondAttribute="bottom" id="bmD-bG-2QS"/>
                             <constraint firstItem="mia-XC-A8d" firstAttribute="leading" secondItem="Sml-Qx-H9e" secondAttribute="leading" id="eJt-O9-kzA"/>
                             <constraint firstItem="mia-XC-A8d" firstAttribute="leading" secondItem="Sml-Qx-H9e" secondAttribute="leading" id="eJt-O9-kzA"/>

+ 30 - 0
Apex Mobile/Apex Mobile/RANetwork.m

@@ -439,6 +439,8 @@
     
     
     NSError *error=nil;
     NSError *error=nil;
     NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
     NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
+    
+    
     if(jsobj)
     if(jsobj)
     {
     {
         int result = [[jsobj valueForKey:@"result"] intValue];
         int result = [[jsobj valueForKey:@"result"] intValue];
@@ -474,6 +476,34 @@
 //        }
 //        }
         
         
         int count =[[jsobj valueForKey:@"count"] intValue];
         int count =[[jsobj valueForKey:@"count"] intValue];
+        
+        if ([[params objectForKey:@"action_type"] isEqualToString:@"Detail"]) {
+            NSMutableDictionary *mJson = [jsobj mutableCopy];
+            NSDictionary *comm = @{
+                                   @"_name": @"Communication",
+                                   @"_type": @"communication",
+                                   @"cc": @"",
+                                   @"receipt": @"",
+                                   @"count": @2,
+                                   @"item0": @{
+                                           @"Sender": @"user name",
+                                           @"msg": @"content bla bla bla...",
+                                           @"mst_time": @"04/28/2018 20:15:33",
+                                           @"email_url": @"https://..."
+                                           },
+                                   @"item1": @{
+                                           @"Sender": @"user name",
+                                           @"msg": @"content bla bla bla...",
+                                           @"mst_time": @"04/28/2018 20:15:33"
+                                           }
+                                   };
+            [mJson setObject:comm forKey:[NSString stringWithFormat:@"group%d",count]];
+            
+            [mJson setObject:@(++count) forKey:@"count"];
+            
+            jsobj = mJson;
+        }
+        
         detailContent.result_code = RESULT_TRUE;
         detailContent.result_code = RESULT_TRUE;
         if(count==0)
         if(count==0)
         {
         {