Files
real-e-party-iOS/YuMi/E-P/NewMoments/Controllers/EPMomentViewController.m
edwinQQQ 2d0063396c feat: 添加 E-Parti 启动画面及情绪颜色引导功能
主要变更:
1. 新增 ep_splash.png 作为应用启动时的展示图像。
2. 更新 Info.plist 中的应用名称和相关描述,替换为 "E-Parti"。
3. 引入 EPSignatureColorGuideView 和 EPEmotionColorStorage,支持用户选择和保存专属情绪颜色。
4. 在 AppDelegate 中集成情绪颜色引导逻辑,确保用户首次登录时能够选择专属颜色。

此更新旨在提升用户体验,增强应用的品牌识别度,并提供个性化的情绪表达功能。
2025-10-15 15:56:32 +08:00

156 lines
5.2 KiB
Objective-C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// EPMomentViewController.m
// YuMi
//
// Created by AI on 2025-10-09.
// Copyright © 2025 YuMi. All rights reserved.
//
#import "EPMomentViewController.h"
#import <UIKit/UIKit.h>
#import <Masonry/Masonry.h>
#import "EPMomentCell.h"
#import "EPMomentListView.h"
#import "EPMomentPublishViewController.h"
#import "YUMIMacroUitls.h"
@interface EPMomentViewController ()
// MARK: - UI Components
/// 列表视图MVVMView
@property (nonatomic, strong) EPMomentListView *listView;
/// 顶部固定文案
@property (nonatomic, strong) UILabel *topTipLabel;
@end
@implementation EPMomentViewController
// MARK: - Lifecycle
- (void)viewDidLoad {
[super viewDidLoad];
self.title = @"Enjoy your Life Time";
// 设置 title 为白色
[self.navigationController.navigationBar setTitleTextAttributes:@{
NSForegroundColorAttributeName: [UIColor whiteColor]
}];
[self setupUI];
[self.listView reloadFirstPage];
// 监听发布成功通知
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(onMomentPublishSuccess:)
name:EPMomentPublishSuccessNotification
object:nil];
NSLog(@"[EPMomentViewController] 页面加载完成");
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
}
// MARK: - Setup UI
- (void)setupUI {
UIImageView *bgImageView = [[UIImageView alloc] initWithImage:kImage(@"vc_bg")];
bgImageView.contentMode = UIViewContentModeScaleAspectFill;
bgImageView.clipsToBounds = YES;
[self.view addSubview:bgImageView];
[bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self.view);
}];
// 顶部固定文案
[self.view addSubview:self.topTipLabel];
[self.topTipLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.view.mas_safeAreaLayoutGuideTop).offset(8);
make.leading.trailing.equalTo(self.view).inset(20);
}];
// 列表视图
[self.view addSubview:self.listView];
[self.listView mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.trailing.bottom.equalTo(self.view);
make.top.equalTo(self.topTipLabel.mas_bottom).offset(8);
}];
// 右上角发布按钮
UIImage *addIcon = [UIImage imageNamed:@"icon_moment_add"];
UIButton *publishButton = [UIButton buttonWithType:UIButtonTypeCustom];
[publishButton setImage:addIcon forState:UIControlStateNormal];
publishButton.frame = CGRectMake(0, 0, 40, 50);
[publishButton addTarget:self action:@selector(onPublishButtonTapped) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *publishItem = [[UIBarButtonItem alloc] initWithCustomView:publishButton];
self.navigationItem.rightBarButtonItem = publishItem;
NSLog(@"[EPMomentViewController] UI 设置完成");
}
// 不再在 VC 内部直接发请求/维护分页
// MARK: - Actions
- (void)onPublishButtonTapped {
NSLog(@"[EPMomentViewController] 发布按钮点击");
EPMomentPublishViewController *vc = [[EPMomentPublishViewController alloc] init];
vc.modalPresentationStyle = UIModalPresentationFullScreen;
[self.navigationController presentViewController:vc animated:YES completion:nil];
}
- (void)showAlertWithMessage:(NSString *)message {
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示"
message:message
preferredStyle:UIAlertControllerStyleAlert];
[alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:nil]];
[self presentViewController:alert animated:YES completion:nil];
}
- (void)onMomentPublishSuccess:(NSNotification *)notification {
NSLog(@"[EPMomentViewController] 收到发布成功通知,刷新列表");
[self.listView reloadFirstPage];
}
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
// 列表点击回调由 listView 暴露
// MARK: - Lazy Loading
// Lazy
- (EPMomentListView *)listView {
if (!_listView) {
_listView = [[EPMomentListView alloc] initWithFrame:CGRectZero];
__weak typeof(self) weakSelf = self;
_listView.onSelectMoment = ^(NSInteger index) {
__strong typeof(weakSelf) self = weakSelf;
[self showAlertWithMessage:[NSString stringWithFormat:@"点击了第 %ld 条动态", (long)index]];
};
}
return _listView;
}
- (UILabel *)topTipLabel {
if (!_topTipLabel) {
_topTipLabel = [UILabel new];
_topTipLabel.numberOfLines = 0;
_topTipLabel.textColor = [UIColor whiteColor];
_topTipLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightRegular];
_topTipLabel.text = @"The disease is like a cruel ruler, measuring the true length of my life, but it is also like a lamp, illuminating the present that I have always ignored. Now I feel a strange freedom: since the end is clear, I can take every step with my whole heart.";
}
return _topTipLabel;
}
// 无数据源属性
@end