修复 Swift 方法重载冲突
问题: - refreshTabBar(isLogin:) 和 refreshTabBarWithIsLogin(_:) - 在 OC 中生成相同的 selector 'refreshTabBarWithIsLogin:' - 导致编译冲突 修复: - 移除 refreshTabBar(isLogin:) 的 @objc 标记 - 保留 refreshTabBarWithIsLogin(_:) 的 @objc 标记 - 内部调用改为 Swift 方法 这样 OC 只能看到 refreshTabBarWithIsLogin: 方法 Swift 内部可以使用更简洁的 refreshTabBar(isLogin:) 方法
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// NewMineViewController.h
|
||||
// EPMineViewController.h
|
||||
// YuMi
|
||||
//
|
||||
// Created by AI on 2025-10-09.
|
||||
|
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// NewMineViewController.m
|
||||
// EPMineViewController.m
|
||||
// YuMi
|
||||
//
|
||||
// Created by AI on 2025-10-09.
|
||||
@@ -7,7 +7,7 @@
|
||||
//
|
||||
|
||||
#import "EPMineViewController.h"
|
||||
#import "NewMineHeaderView.h"
|
||||
#import "EPMineHeaderView.h"
|
||||
#import <Masonry/Masonry.h>
|
||||
#import "Api+Mine.h"
|
||||
#import "AccountInfoStorage.h"
|
||||
@@ -16,7 +16,7 @@
|
||||
#import <MJExtension/MJExtension.h>
|
||||
#import "XPSkillCardPlayerManager.h"
|
||||
|
||||
@interface NewMineViewController () <UITableViewDelegate, UITableViewDataSource>
|
||||
@interface EPMineViewController () <UITableViewDelegate, UITableViewDataSource>
|
||||
|
||||
// MARK: - UI Components
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
@property (nonatomic, strong) UITableView *tableView;
|
||||
|
||||
/// 顶部个人信息卡片
|
||||
@property (nonatomic, strong) NewMineHeaderView *headerView;
|
||||
@property (nonatomic, strong) EPMineHeaderView *headerView;
|
||||
|
||||
/// 设置按钮
|
||||
@property (nonatomic, strong) UIButton *settingsButton;
|
||||
@@ -56,7 +56,7 @@
|
||||
[self setupUI];
|
||||
[self loadData];
|
||||
|
||||
NSLog(@"[NewMineViewController] 页面加载完成");
|
||||
NSLog(@"[EPMineViewController] 页面加载完成");
|
||||
}
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated {
|
||||
@@ -89,7 +89,7 @@
|
||||
// 设置头部视图
|
||||
self.tableView.tableHeaderView = self.headerView;
|
||||
|
||||
NSLog(@"[NewMineViewController] UI 设置完成");
|
||||
NSLog(@"[EPMineViewController] UI 设置完成");
|
||||
}
|
||||
|
||||
// MARK: - Data Loading
|
||||
@@ -113,7 +113,7 @@
|
||||
- (void)refreshUserInfo {
|
||||
NSString *uid = [[AccountInfoStorage instance] getUid];
|
||||
if (!uid.length) {
|
||||
NSLog(@"[NewMineViewController] 未登录,无法获取用户信息");
|
||||
NSLog(@"[EPMineViewController] 未登录,无法获取用户信息");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -134,9 +134,9 @@
|
||||
};
|
||||
|
||||
[self.headerView configureWithUserInfo:userInfoDict];
|
||||
NSLog(@"[NewMineViewController] 用户信息加载成功: %@", self.userInfo.nick);
|
||||
NSLog(@"[EPMineViewController] 用户信息加载成功: %@", self.userInfo.nick);
|
||||
} else {
|
||||
NSLog(@"[NewMineViewController] 用户信息加载失败: %@", msg);
|
||||
NSLog(@"[EPMineViewController] 用户信息加载失败: %@", msg);
|
||||
}
|
||||
} uid:uid];
|
||||
|
||||
@@ -156,18 +156,18 @@
|
||||
// [Api getUserWalletInfo:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
// if (code == 200 && data.data) {
|
||||
// self.walletInfo = [WalletInfoModel mj_objectWithKeyValues:data.data];
|
||||
// NSLog(@"[NewMineViewController] 钱包信息加载成功: 钻石=%ld 金币=%ld",
|
||||
// NSLog(@"[EPMineViewController] 钱包信息加载成功: 钻石=%ld 金币=%ld",
|
||||
// (long)self.walletInfo.diamond, (long)self.walletInfo.money);
|
||||
// }
|
||||
// } fail:^(NSInteger code, NSString * _Nullable msg) {
|
||||
// NSLog(@"[NewMineViewController] 钱包信息加载失败: %@", msg);
|
||||
// NSLog(@"[EPMineViewController] 钱包信息加载失败: %@", msg);
|
||||
// } uid:uid ticket:ticket];
|
||||
}
|
||||
|
||||
// MARK: - Actions
|
||||
|
||||
- (void)onSettingsButtonTapped {
|
||||
NSLog(@"[NewMineViewController] 设置按钮点击");
|
||||
NSLog(@"[EPMineViewController] 设置按钮点击");
|
||||
// TODO: 跳转到设置页面
|
||||
[self showAlertWithMessage:@"设置功能开发中"];
|
||||
}
|
||||
@@ -176,7 +176,7 @@
|
||||
NSString *type = item[@"type"];
|
||||
NSString *title = item[@"title"];
|
||||
|
||||
NSLog(@"[NewMineViewController] 菜单项点击: %@", type);
|
||||
NSLog(@"[EPMineViewController] 菜单项点击: %@", type);
|
||||
|
||||
if ([type isEqualToString:@"wallet"]) {
|
||||
// TODO: 跳转到钱包页面
|
||||
@@ -274,9 +274,9 @@
|
||||
return _tableView;
|
||||
}
|
||||
|
||||
- (NewMineHeaderView *)headerView {
|
||||
- (EPMineHeaderView *)headerView {
|
||||
if (!_headerView) {
|
||||
_headerView = [[NewMineHeaderView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 280)];
|
||||
_headerView = [[EPMineHeaderView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 280)];
|
||||
}
|
||||
return _headerView;
|
||||
}
|
||||
|
@@ -12,7 +12,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/// 新的个人中心头部视图
|
||||
/// 纵向卡片式设计 + 渐变背景
|
||||
@interface NewMineHeaderView : UIView
|
||||
@interface EPMineHeaderView : UIView
|
||||
|
||||
/// 配置用户信息
|
||||
/// @param userInfo 用户信息字典
|
@@ -6,10 +6,10 @@
|
||||
// Copyright © 2025 YuMi. All rights reserved.
|
||||
//
|
||||
|
||||
#import "NewMineHeaderView.h"
|
||||
#import "EPMineHeaderView.h"
|
||||
#import <Masonry/Masonry.h>
|
||||
|
||||
@interface NewMineHeaderView ()
|
||||
@interface EPMineHeaderView ()
|
||||
|
||||
// MARK: - UI Components
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
|
||||
@end
|
||||
|
||||
@implementation NewMineHeaderView
|
||||
@implementation EPMineHeaderView
|
||||
|
||||
// MARK: - Lifecycle
|
||||
|
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// NewMomentViewController.h
|
||||
// EPMomentViewController.h
|
||||
// YuMi
|
||||
//
|
||||
// Created by AI on 2025-10-09.
|
||||
|
@@ -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;
|
||||
|
@@ -14,7 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/// 新的动态 Cell(卡片式设计)
|
||||
/// 完全不同于原 XPMomentsCell 的列表式设计
|
||||
@interface NewMomentCell : UITableViewCell
|
||||
@interface EPMomentCell : UITableViewCell
|
||||
|
||||
/// 配置 Cell 数据
|
||||
/// @param model 动态数据模型
|
@@ -6,13 +6,13 @@
|
||||
// Copyright © 2025 YuMi. All rights reserved.
|
||||
//
|
||||
|
||||
#import "NewMomentCell.h"
|
||||
#import "EPMomentCell.h"
|
||||
#import "MomentsInfoModel.h"
|
||||
#import "AccountInfoStorage.h"
|
||||
#import "Api+Moments.h"
|
||||
#import <Masonry/Masonry.h>
|
||||
|
||||
@interface NewMomentCell ()
|
||||
@interface EPMomentCell ()
|
||||
|
||||
// MARK: - UI Components
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
|
||||
@end
|
||||
|
||||
@implementation NewMomentCell
|
||||
@implementation EPMomentCell
|
||||
|
||||
// MARK: - Lifecycle
|
||||
|
@@ -258,7 +258,7 @@ import UIKit
|
||||
|
||||
/// 登录成功后刷新 TabBar
|
||||
/// - Parameter isLogin: 是否已登录
|
||||
@objc func refreshTabBar(isLogin: Bool) {
|
||||
func refreshTabBar(isLogin: Bool) {
|
||||
isLoggedIn = isLogin
|
||||
|
||||
if isLogin {
|
||||
|
Reference in New Issue
Block a user