Detail consideration and implementation of the circle of friends comment function, details of the circle of friends comment function
1. circle of friends
The layout of the circle of friends is very easy, and there are a lot of similar code on the Internet, but some details of the comment function should be considered, mainly for the user experience.
Similar to the keyboard, do not block comment boxes. As the content increases, there are many ways to handle these online content, which will not be listed here.
As long as you press the comments in the circle of friends, the dialog box is raised to the bottom of the page. This small detail has a very good user experience, and there are many implementation methods, the following describes the implementation method.
2. Implementation of comment details
My method is to save the coordinates y at the end of the cell where the button is located when you press the comment button.
self.replyViewDraw = [cell convertRect:cell.bounds toView:self.view.window].origin.y + cell.frame.size.height;
Then, when the keyboard is upgraded, the comment box is also raised to the top of the keyboard. At this time, the coordinate y of the keyboard minus the position y saved above is the position where tableView needs to be moved.
How to move the comment box: Change frame. origin. y
How to move tableview: Change contentOffset. y
[UIView animateWithDuration:[dic[UIKeyboardAnimationDurationUserInfoKey] floatValue] animations:^{ [UIView setAnimationCurve:[dic[UIKeyboardAnimationCurveUserInfoKey] doubleValue]]; CGRect frame = self.replyInputView.frame; frame.origin.y = frame.origin.y - keyboardRect.size.height + 52; self.replyInputView.frame = frame; CGPoint point = self.familyTableView.contentOffset; point.y -= (frame.origin.y - self.replyViewDraw); self.familyTableView.contentOffset = point; }];
3. circle of friends
The functions of the circle of friends are basically implemented, and many details are taken into consideration. If you are interested, you can download them and check them out.
Github address: https://github.com/stevenxiaoyang/familyGroup