修复 Swift 方法重载冲突
问题: - refreshTabBar(isLogin:) 和 refreshTabBarWithIsLogin(_:) - 在 OC 中生成相同的 selector 'refreshTabBarWithIsLogin:' - 导致编译冲突 修复: - 移除 refreshTabBar(isLogin:) 的 @objc 标记 - 保留 refreshTabBarWithIsLogin(_:) 的 @objc 标记 - 内部调用改为 Swift 方法 这样 OC 只能看到 refreshTabBarWithIsLogin: 方法 Swift 内部可以使用更简洁的 refreshTabBar(isLogin:) 方法
This commit is contained in:
@@ -7,14 +7,14 @@
|
||||
//
|
||||
|
||||
#import "EPMomentViewController.h"
|
||||
#import "NewMomentCell.h"
|
||||
#import "EPMomentCell.h"
|
||||
#import <Masonry/Masonry.h>
|
||||
#import "Api+Moments.h"
|
||||
#import "AccountInfoStorage.h"
|
||||
#import "MomentsInfoModel.h"
|
||||
#import <MJExtension/MJExtension.h>
|
||||
|
||||
@interface NewMomentViewController () <UITableViewDelegate, UITableViewDataSource>
|
||||
@interface EPMomentViewController () <UITableViewDelegate, UITableViewDataSource>
|
||||
|
||||
// MARK: - UI Components
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
make.size.mas_equalTo(CGSizeMake(56, 56));
|
||||
}];
|
||||
|
||||
NSLog(@"[NewMomentViewController] UI 设置完成");
|
||||
NSLog(@"[EPMomentViewController] UI 设置完成");
|
||||
}
|
||||
|
||||
// MARK: - Data Loading
|
||||
@@ -89,7 +89,7 @@
|
||||
if (self.isLoading) return;
|
||||
|
||||
self.isLoading = YES;
|
||||
NSLog(@"[NewMomentViewController] 开始加载数据,页码: %ld", (long)self.currentPage);
|
||||
NSLog(@"[EPMomentViewController] 开始加载数据,页码: %ld", (long)self.currentPage);
|
||||
|
||||
// 调用真实 API 加载动态列表
|
||||
NSString *page = [NSString stringWithFormat:@"%ld", (long)self.currentPage];
|
||||
@@ -108,12 +108,12 @@
|
||||
[self.dataSource addObjectsFromArray:list];
|
||||
self.currentPage++;
|
||||
[self.tableView reloadData];
|
||||
NSLog(@"[NewMomentViewController] 加载成功,新增 %lu 条动态", (unsigned long)list.count);
|
||||
NSLog(@"[EPMomentViewController] 加载成功,新增 %lu 条动态", (unsigned long)list.count);
|
||||
} else {
|
||||
NSLog(@"[NewMomentViewController] 没有更多数据");
|
||||
NSLog(@"[EPMomentViewController] 没有更多数据");
|
||||
}
|
||||
} else {
|
||||
NSLog(@"[NewMomentViewController] 加载失败: code=%ld, msg=%@", (long)code, msg);
|
||||
NSLog(@"[EPMomentViewController] 加载失败: code=%ld, msg=%@", (long)code, msg);
|
||||
// 如果 API 失败,显示提示
|
||||
if (self.dataSource.count == 0) {
|
||||
// 首次加载失败,显示空状态
|
||||
@@ -132,7 +132,7 @@
|
||||
// MARK: - Actions
|
||||
|
||||
- (void)onPublishButtonTapped {
|
||||
NSLog(@"[NewMomentViewController] 发布按钮点击");
|
||||
NSLog(@"[EPMomentViewController] 发布按钮点击");
|
||||
// TODO: 跳转到发布页面
|
||||
[self showAlertWithMessage:@"发布功能开发中"];
|
||||
}
|
||||
@@ -152,7 +152,7 @@
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
NewMomentCell *cell = [tableView dequeueReusableCellWithIdentifier:@"NewMomentCell" forIndexPath:indexPath];
|
||||
EPMomentCell *cell = [tableView dequeueReusableCellWithIdentifier:@"NewMomentCell" forIndexPath:indexPath];
|
||||
|
||||
if (indexPath.row < self.dataSource.count) {
|
||||
MomentsInfoModel *model = self.dataSource[indexPath.row];
|
||||
@@ -167,7 +167,7 @@
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
[tableView deselectRowAtIndexPath:indexPath animated:YES];
|
||||
|
||||
NSLog(@"[NewMomentViewController] 点击动态: %ld", (long)indexPath.row);
|
||||
NSLog(@"[EPMomentViewController] 点击动态: %ld", (long)indexPath.row);
|
||||
// TODO: 跳转到详情页
|
||||
[self showAlertWithMessage:[NSString stringWithFormat:@"点击了第 %ld 条动态", (long)indexPath.row]];
|
||||
}
|
||||
@@ -206,7 +206,7 @@
|
||||
_tableView.contentInset = UIEdgeInsetsMake(10, 0, 10, 0);
|
||||
|
||||
// 注册 Cell
|
||||
[_tableView registerClass:[NewMomentCell class] forCellReuseIdentifier:@"NewMomentCell"];
|
||||
[_tableView registerClass:[EPMomentCell class] forCellReuseIdentifier:@"NewMomentCell"];
|
||||
|
||||
// 添加下拉刷新
|
||||
_tableView.refreshControl = self.refreshControl;
|
||||
|
Reference in New Issue
Block a user