|
@@ -55,14 +55,11 @@ static CGFloat textFieldH = 56;
|
|
|
|
|
|
@property (nonatomic, strong) SDTimeLineCellCommentItemModel *currentCommentItemModel;
|
|
@property (nonatomic, strong) SDTimeLineCellCommentItemModel *currentCommentItemModel;
|
|
|
|
|
|
-@property (nonatomic, assign) NSInteger currentPageIndex;
|
|
|
|
@end
|
|
@end
|
|
|
|
|
|
@implementation SDTimeLineTableViewController
|
|
@implementation SDTimeLineTableViewController
|
|
|
|
|
|
{
|
|
{
|
|
-// SDTimeLineRefreshFooter *_refreshFooter;
|
|
|
|
-// SDTimeLineRefreshHeader *_refreshHeader;
|
|
|
|
CGFloat _lastScrollViewOffsetY;
|
|
CGFloat _lastScrollViewOffsetY;
|
|
CGFloat _totalKeybordHeight;
|
|
CGFloat _totalKeybordHeight;
|
|
}
|
|
}
|
|
@@ -70,19 +67,7 @@ static CGFloat textFieldH = 56;
|
|
- (void)viewDidLoad
|
|
- (void)viewDidLoad
|
|
{
|
|
{
|
|
[super viewDidLoad];
|
|
[super viewDidLoad];
|
|
-
|
|
|
|
- //LEETheme 分为两种模式 , 独立设置模式 JSON设置模式 , 朋友圈demo展示的是独立设置模式的使用 , 微信聊天demo 展示的是JSON模式的使用
|
|
|
|
-
|
|
|
|
- UIBarButtonItem *rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"日间" style:UIBarButtonItemStyleDone target:self action:@selector(rightBarButtonItemAction:)];
|
|
|
|
-
|
|
|
|
- //为self.view 添加背景颜色设置
|
|
|
|
-
|
|
|
|
- self.view.lee_theme
|
|
|
|
- .LeeAddBackgroundColor(DAY , [UIColor whiteColor])
|
|
|
|
- .LeeAddBackgroundColor(NIGHT , [UIColor blackColor]);
|
|
|
|
-
|
|
|
|
- self.navigationItem.rightBarButtonItem = rightBarButtonItem;
|
|
|
|
-
|
|
|
|
|
|
+
|
|
if (@available(iOS 11.0, *)) {
|
|
if (@available(iOS 11.0, *)) {
|
|
self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
|
self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
|
} else {
|
|
} else {
|
|
@@ -90,20 +75,21 @@ static CGFloat textFieldH = 56;
|
|
}
|
|
}
|
|
self.edgesForExtendedLayout = UIRectEdgeTop;
|
|
self.edgesForExtendedLayout = UIRectEdgeTop;
|
|
|
|
|
|
-
|
|
|
|
- self.currentPageIndex = 1;
|
|
|
|
|
|
+ if (!self.userModel) {
|
|
|
|
+ self.userModel = [SLGlobalInfo SharedInstance].loginInfo.user;
|
|
|
|
+ }
|
|
SDTimeLineTableHeaderView *headerView = [SDTimeLineTableHeaderView new];
|
|
SDTimeLineTableHeaderView *headerView = [SDTimeLineTableHeaderView new];
|
|
- headerView.frame = CGRectMake(0, 0, 0, 260);
|
|
|
|
|
|
+ headerView.frame = CGRectMake(0, 0, 0, 220 * KScaleW);
|
|
self.tableView.tableHeaderView = headerView;
|
|
self.tableView.tableHeaderView = headerView;
|
|
|
|
|
|
//添加分隔线颜色设置
|
|
//添加分隔线颜色设置
|
|
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
|
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
|
-
|
|
|
|
[self.tableView registerClass:[SDTimeLineCell class] forCellReuseIdentifier:kTimeLineTableViewCellId];
|
|
[self.tableView registerClass:[SDTimeLineCell class] forCellReuseIdentifier:kTimeLineTableViewCellId];
|
|
|
|
|
|
|
|
|
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardNotification:) name:UIKeyboardWillChangeFrameNotification object:nil];
|
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardNotification:) name:UIKeyboardWillChangeFrameNotification object:nil];
|
|
- [self creatModelsWithCount:self.currentPageIndex];
|
|
|
|
|
|
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(momentsUpdate:) name:@"SLMomentsUpdate" object:nil];
|
|
|
|
+ [self creatModelsWithCount:0];
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -111,6 +97,7 @@ static CGFloat textFieldH = 56;
|
|
{
|
|
{
|
|
[super viewDidAppear:animated];
|
|
[super viewDidAppear:animated];
|
|
[self setupTextField];
|
|
[self setupTextField];
|
|
|
|
+ [self creatModelsWithCount:0];
|
|
}
|
|
}
|
|
|
|
|
|
- (void)viewWillDisappear:(BOOL)animated
|
|
- (void)viewWillDisappear:(BOOL)animated
|
|
@@ -129,6 +116,10 @@ static CGFloat textFieldH = 56;
|
|
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
|
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+- (void)momentsUpdate:(NSNotificationCenter *)conter {
|
|
|
|
+ [self creatModelsWithCount:0];
|
|
|
|
+}
|
|
|
|
+
|
|
- (void)setupTextField
|
|
- (void)setupTextField
|
|
{
|
|
{
|
|
self.moentsChatView = [[SLMoentsChatView alloc] initWithFrame:CGRectMake(0, [UIScreen mainScreen].bounds.size.height, self.view.width_sd, textFieldH)];
|
|
self.moentsChatView = [[SLMoentsChatView alloc] initWithFrame:CGRectMake(0, [UIScreen mainScreen].bounds.size.height, self.view.width_sd, textFieldH)];
|
|
@@ -181,19 +172,6 @@ static CGFloat textFieldH = 56;
|
|
};
|
|
};
|
|
}
|
|
}
|
|
|
|
|
|
-// 右栏目按钮点击事件
|
|
|
|
-
|
|
|
|
-- (void)rightBarButtonItemAction:(UIBarButtonItem *)sender{
|
|
|
|
-
|
|
|
|
- if ([[LEETheme currentThemeTag] isEqualToString:DAY]) {
|
|
|
|
-
|
|
|
|
- [LEETheme startTheme:NIGHT];
|
|
|
|
-
|
|
|
|
- } else {
|
|
|
|
- [LEETheme startTheme:DAY];
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
- (void)creatModelsWithCount:(NSInteger)count
|
|
- (void)creatModelsWithCount:(NSInteger)count
|
|
{
|
|
{
|
|
WEAKSELF;
|
|
WEAKSELF;
|
|
@@ -202,6 +180,7 @@ static CGFloat textFieldH = 56;
|
|
NSDictionary *parameter = @{@"PageIndex": @(pageNo),
|
|
NSDictionary *parameter = @{@"PageIndex": @(pageNo),
|
|
@"PageSize": @(SLPageSize),
|
|
@"PageSize": @(SLPageSize),
|
|
@"type" : @"0",
|
|
@"type" : @"0",
|
|
|
|
+ @"userId" : self.userModel.userId,
|
|
};
|
|
};
|
|
WS(weakSelf);
|
|
WS(weakSelf);
|
|
[[SLHttpCenter SharedInstance] getWithUrl:@"/api/Friend/GetFriendList" parameter:parameter success:^(id responseObject) {
|
|
[[SLHttpCenter SharedInstance] getWithUrl:@"/api/Friend/GetFriendList" parameter:parameter success:^(id responseObject) {
|
|
@@ -345,7 +324,6 @@ static CGFloat textFieldH = 56;
|
|
} failure:^(SPRequestError *error) {
|
|
} failure:^(SPRequestError *error) {
|
|
|
|
|
|
}];
|
|
}];
|
|
-
|
|
|
|
if (!model.isLike) {
|
|
if (!model.isLike) {
|
|
SDTimeLineCellLikeItemModel *likeModel = [SDTimeLineCellLikeItemModel new];
|
|
SDTimeLineCellLikeItemModel *likeModel = [SDTimeLineCellLikeItemModel new];
|
|
likeModel.userName = model.userName;
|
|
likeModel.userName = model.userName;
|
|
@@ -364,7 +342,6 @@ static CGFloat textFieldH = 56;
|
|
model.isLike = NO;
|
|
model.isLike = NO;
|
|
}
|
|
}
|
|
model.likeItemsArray = [temp copy];
|
|
model.likeItemsArray = [temp copy];
|
|
-
|
|
|
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.25 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.25 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
[self.tableView reloadRowsAtIndexPaths:@[index] withRowAnimation:UITableViewRowAnimationNone];
|
|
[self.tableView reloadRowsAtIndexPaths:@[index] withRowAnimation:UITableViewRowAnimationNone];
|
|
});
|
|
});
|