首次提交

This commit is contained in:
启星
2025-08-08 11:05:33 +08:00
parent 1b3bb91b4a
commit adc1a2a25d
8803 changed files with 708874 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
//
// BaseTableViewController.h
// JiushiMarking
//
// Created by 小收 on 2019/7/18.
// Copyright © 2019 小收. All rights reserved.
//
#import "BaseViewController.h"
@interface BaseTableViewController : BaseViewController<UITableViewDataSource, UITableViewDelegate>
@property (strong, nonatomic) UITableView *tableView;
@property (strong, nonatomic) NSMutableArray *dataArray;
@property (assign, nonatomic) NSInteger page;
///获取数据
- (void)fetchData;
///刷新
- (void)refreshFetchData;
///加载
- (void)fetchMoreData;
/*
* 结束刷新
*/
-(void)endFooterRefreshWithMore;
-(void)endFooterRefreshWithNoMore;
- (void)endRefresh;
- (void)showPullToRefresh;
- (void)hidePullToRefresh;
- (void)showLoadMoreRefresh;
- (void)hideLoadMoreRefresh;
-(void)showNoContentView;
-(void)hideNoContentView;
@end

View File

@@ -0,0 +1,144 @@
//
// BaseTableViewController.m
// JiushiMarking
//
// Created by on 2019/7/18.
// Copyright © 2019 . All rights reserved.
//
#import "BaseTableViewController.h"
@interface BaseTableViewController ()
@end
@implementation BaseTableViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.dataArray = [[NSMutableArray alloc] initWithCapacity:0];
self.page = 1;
CGRect tableFrame = CGRectMake(0, yb_NavigationBar_H, ScreenWidth, ScreenHeight-TOP_BAR_HEIGHT-TabBar_H);
if (self.hidesBottomBarWhenPushed == YES) {
tableFrame.size.height = tableFrame.size.height + TabBar_H;
}
self.tableView.contentInset = UIEdgeInsetsMake(0, 0, SAFE_AREA_INSERTS_BOTTOM, 0);
self.tableView = [[UITableView alloc] initWithFrame:tableFrame style:UITableViewStylePlain];
self.tableView.backgroundColor = [UIColor clearColor];
self.tableView.delegate = self;
self.tableView.dataSource = self;
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
[self.view addSubview:self.tableView];
if (@available(iOS 11.0, *)){
self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
}else{
self.automaticallyAdjustsScrollViewInsets = NO;
}
if (@available(iOS 15.0, *)){
self.tableView.sectionHeaderTopPadding = 0;
}
//iOS11
self.tableView.estimatedRowHeight = 0;
self.tableView.estimatedSectionHeaderHeight = 0;
self.tableView.estimatedSectionFooterHeight = 0;
//
self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(refreshFetchData)];
self.tableView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(fetchMoreData)];
[self hidePullToRefresh];
[self hideLoadMoreRefresh];
}
#pragma mark - UIScrollViewDelegate
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView {
[self.view endEditing:YES];
}
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.dataArray.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
return cell;
}
-(void)showNoContentView {
[self.noContentV removeFromSuperview];
self.noContentV.frame = CGRectMake(0, 0, self.tableView.bounds.size.width, self.tableView.bounds.size.height);
[self.tableView addSubview:self.noContentV];
}
-(void)hideNoContentView {
[self.noContentV removeFromSuperview];
}
#pragma mark -
//
-(void)fetchData {
}
//
- (void)refreshFetchData {
}
//
- (void)fetchMoreData {
}
- (void)showPullToRefresh {
self.tableView.mj_header.hidden = NO;
}
- (void)hidePullToRefresh {
self.tableView.mj_header.hidden = YES;
}
- (void)showLoadMoreRefresh {
self.tableView.mj_footer.hidden = NO;
}
- (void)hideLoadMoreRefresh {
self.tableView.mj_footer.hidden = YES;
}
-(void)endFooterRefreshWithMore{
self.tableView.mj_footer.hidden = NO;
[self.tableView.mj_footer endRefreshing];
}
-(void)endFooterRefreshWithNoMore{
self.tableView.mj_footer.hidden = NO;
[self.tableView.mj_footer endRefreshingWithNoMoreData];
}
- (void)endRefresh {
if ([self.tableView.mj_header isRefreshing]) {
[self.tableView.mj_header endRefreshing];
} else if ([self.tableView.mj_footer isRefreshing]) {
[self.tableView.mj_footer endRefreshing];
}
}
@end

View File

@@ -0,0 +1,25 @@
//
// BaseViewController.h
// JiushiMarking
//
// Created by 小收 on 2019/7/18.
// Copyright © 2019 小收. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "NoContentView.h"
#import "CustomNaviBarView.h"
@interface BaseViewController : UIViewController
@property(nonatomic, strong)NoContentView *noContentV;
@property(nonatomic, strong)CustomNaviBarView *naviView;
-(void)showNaviBarWithTitle:(NSString *)title;
-(void)onNaviBack;
-(void)onChangeNaviWhiteStyle;
@end

View File

@@ -0,0 +1,64 @@
//
// BaseViewController.m
// JiushiMarking
//
// Created by on 2019/7/18.
// Copyright © 2019 . All rights reserved.
//
#import "BaseViewController.h"
@interface BaseViewController ()
@end
@implementation BaseViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = HEXCOLOR(0xFFFFFF);
}
-(void)showNaviBarWithTitle:(NSString *)title {
[self.view addSubview:self.naviView];
[self.naviView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.left.right.equalTo(self.view);
make.height.mas_equalTo(yb_NavigationBar_H);
}];
self.naviView.titleLab.text = title;
}
-(void)onNaviBack {
if (self.navigationController) {
[self.navigationController popViewControllerAnimated:YES];
}else{
[self dismissViewControllerAnimated:YES completion:nil];
}
}
-(void)onChangeNaviWhiteStyle {
[self.naviView.backBtn setImage:ImageNamed(@"blackBack") forState:UIControlStateNormal];
self.naviView.titleLab.textColor = kWhiteColor;
}
- (NoContentView *)noContentV {
if (_noContentV == nil) {
_noContentV = [[NSBundle mainBundle] loadNibNamed:@"NoContentView" owner:self options:nil].firstObject;
_noContentV.backgroundColor = [UIColor clearColor];
}
return _noContentV;
}
- (CustomNaviBarView *)naviView {
if (_naviView == nil) {
_naviView = [[NSBundle mainBundle] loadNibNamed:@"CustomNaviBarView" owner:self options:nil].firstObject;
WEAK_SELF
_naviView.onBackBlock = ^{
[weakSelf onNaviBack];
};
}
return _naviView;
}
@end

View File

@@ -0,0 +1,22 @@
//
// CustomNaviBarView.h
// DreamTown
//
// Created by 小收 on 2020/11/12.
// Copyright © 2020 小收. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface CustomNaviBarView : UIView
@property (weak, nonatomic) IBOutlet UIButton *backBtn;
@property (weak, nonatomic) IBOutlet UILabel *titleLab;
@property (nonatomic, copy) void(^onBackBlock)(void);
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,19 @@
//
// CustomNaviBarView.m
// DreamTown
//
// Created by on 2020/11/12.
// Copyright © 2020 . All rights reserved.
//
#import "CustomNaviBarView.h"
@implementation CustomNaviBarView
- (IBAction)onBack:(id)sender {
if (self.onBackBlock) {
self.onBackBlock();
}
}
@end

View File

@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="dark"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21679"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB" customClass="CustomNaviBarView">
<rect key="frame" x="0.0" y="0.0" width="375" height="88"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="vub-7C-T7x">
<rect key="frame" x="187.5" y="66" width="0.0" height="0.0"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="18"/>
<color key="textColor" red="0.066666666666666666" green="0.066666666666666666" blue="0.066666666666666666" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="R5P-f6-aWt">
<rect key="frame" x="5" y="51" width="30" height="30"/>
<constraints>
<constraint firstAttribute="width" constant="30" id="1DK-d1-JZh"/>
<constraint firstAttribute="height" constant="30" id="Rkx-HY-BS8"/>
</constraints>
<state key="normal" image="blackBack"/>
<connections>
<action selector="onBack:" destination="iN0-l3-epB" eventType="touchUpInside" id="EIL-yZ-GjA"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="R5P-f6-aWt" firstAttribute="centerY" secondItem="vub-7C-T7x" secondAttribute="centerY" id="A9S-eR-6OF"/>
<constraint firstItem="vub-7C-T7x" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="JF4-Qz-ccW"/>
<constraint firstAttribute="bottom" secondItem="R5P-f6-aWt" secondAttribute="bottom" constant="7" id="Mr1-LX-ZLF"/>
<constraint firstItem="R5P-f6-aWt" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="5" id="l2v-wh-G2P"/>
</constraints>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<connections>
<outlet property="backBtn" destination="R5P-f6-aWt" id="OwR-SE-5hi"/>
<outlet property="titleLab" destination="vub-7C-T7x" id="pgm-sP-Qsg"/>
</connections>
<point key="canvasLocation" x="74.637681159420296" y="-25.446428571428569"/>
</view>
</objects>
<resources>
<image name="blackBack" width="4.5" height="8"/>
</resources>
</document>

View File

@@ -0,0 +1,17 @@
//
// MainNavigationController.h
// JiushiMarking
//
// Created by 小收 on 2019/7/5.
// Copyright © 2019 小收. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface MainNavigationController : UINavigationController
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,42 @@
//
// MainNavigationController.m
// JiushiMarking
//
// Created by on 2019/7/5.
// Copyright © 2019 . All rights reserved.
//
#import "MainNavigationController.h"
@interface MainNavigationController ()<UIGestureRecognizerDelegate>
@end
@implementation MainNavigationController
- (instancetype)initWithRootViewController:(UIViewController *)rootViewController {
if (self == [super initWithRootViewController:rootViewController]) {
self.navigationBar.hidden = YES;
}
return self;
}
- (void)viewDidLoad {
[super viewDidLoad];
self.interactivePopGestureRecognizer.delegate = self;
}
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated {
if (self.viewControllers.count > 0) {
viewController.hidesBottomBarWhenPushed = YES;
}
[super pushViewController:viewController animated:animated];
}
- (UIStatusBarStyle)preferredStatusBarStyle {
UIViewController *topVC = self.topViewController;
return [topVC preferredStatusBarStyle];
}
@end

View File

@@ -0,0 +1,20 @@
//
// NoContentView.h
// DreamTown
//
// Created by 小收 on 2020/1/30.
// Copyright © 2020 小收. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface NoContentView : UIView
@property (weak, nonatomic) IBOutlet UIImageView *imgV;
@property (weak, nonatomic) IBOutlet UILabel *titleLab;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,21 @@
//
// NoContentView.m
// DreamTown
//
// Created by on 2020/1/30.
// Copyright © 2020 . All rights reserved.
//
#import "NoContentView.h"
@implementation NoContentView
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
@end

View File

@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="22505" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22504"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB" customClass="NoContentView">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="page_kong" translatesAutoresizingMaskIntoConstraints="NO" id="yep-tV-a1b">
<rect key="frame" x="104.5" y="256" width="205" height="205"/>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="暂无数据" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bYw-I9-1yK">
<rect key="frame" x="182.5" y="456.5" width="49.5" height="14.5"/>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="12"/>
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="0.59918202510496388" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="yep-tV-a1b" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" multiplier="0.8" id="ArG-TU-uy0"/>
<constraint firstItem="yep-tV-a1b" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="TDX-nb-0Wg"/>
<constraint firstItem="bYw-I9-1yK" firstAttribute="centerX" secondItem="yep-tV-a1b" secondAttribute="centerX" id="XpN-dp-5Zt"/>
<constraint firstItem="bYw-I9-1yK" firstAttribute="bottom" secondItem="yep-tV-a1b" secondAttribute="bottom" constant="10" id="hrT-Fn-mir"/>
</constraints>
<connections>
<outlet property="imgV" destination="yep-tV-a1b" id="fta-nc-Rvf"/>
<outlet property="titleLab" destination="bYw-I9-1yK" id="kWR-tR-acf"/>
</connections>
<point key="canvasLocation" x="131.8840579710145" y="88.392857142857139"/>
</view>
</objects>
<resources>
<image name="page_kong" width="205" height="205"/>
</resources>
</document>

View File

@@ -0,0 +1,16 @@
//
// SPLaunchVC.h
// SweetParty
//
// Created by bj_szd on 2022/5/31.
//
#import "BaseViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface SPLaunchVC : BaseViewController
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,98 @@
//
// SPLaunchVC.m
// SweetParty
//
// Created by bj_szd on 2022/5/31.
//
#import "SPLaunchVC.h"
@interface SPLaunchVC ()
@end
@implementation SPLaunchVC
- (void)viewDidLoad {
[super viewDidLoad];
//
UIImageView *launchImV = [ControlCreator createImageView:self.view rect:CGRectZero imageName:@"a_launch_qx" backguoundColor:nil];
launchImV.contentMode = UIViewContentModeScaleAspectFill;
launchImV.layer.masksToBounds = YES;
[launchImV mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.view);
}];
//
[self getSystemBaseConfigRequest];
}
- (void)getSystemBaseConfigRequest {
NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
NSString *app_version = [infoDictionary objectForKey:@"CFBundleShortVersionString"];
NSDictionary *dict = @{@"app_type":@"2", @"app_version":app_version};
NSMutableDictionary *paras = [NSMutableDictionary dictionary];
[paras addEntriesFromDictionary:dict];
//[SVProgressHUD showWithStatus:nil];
[RCMicHTTP postWithURLString:@"/api/api/get_system_base_config" parameters:paras response:^(RCMicHTTPResult *result) {
NSLog(@"获取配置:\n%@", result);
[SVProgressHUD dismiss];
if (result.success) {
if (result.errorCode == 200 && [result.content isKindOfClass:NSDictionary.class]) {
GVUSER.appConfigDict = result.content;
GVUSER.rongKey = [result.content safeStringForKey:@"ry_app_key"];
GVUSER.socketUrl = [result.content safeStringForKey:@"websocket_server_address"];
GVUSER.withdraw_rate = [result.content safeStringForKey:@"withdraw_rate"];
GVUSER.tencentyun_im_appid = [result.content safeStringForKey:@"tencentyun_im_appid"];
GVUSER.del_user_relation_money = [result.content safeStringForKey:@"del_user_relation_money"];
BJPassData.sharedBJPassData.boxValue_1 = [result.content safeIntForKey:@"silver_price"];
BJPassData.sharedBJPassData.boxValue_2 = [result.content safeIntForKey:@"gold_price"];
BJPassData.sharedBJPassData.boxValue_3 = [result.content safeIntForKey:@"drill_price"];
BJPassData.sharedBJPassData.boxValue_4 = [result.content safeIntForKey:@"platina_price"];
BJPassData.sharedBJPassData.boxValue_5 = [result.content safeIntForKey:@"violet_price"];
BJPassData.sharedBJPassData.boxValue_6 = [result.content safeIntForKey:@"promise_price"];
[self initRongYun];
[self goLoginOrHome];
}else {
[SVProgressHUD showInfoWithStatus:result.message];
[self showErrAlert];
}
}else {
[self showErrAlert];
}
}];
}
- (void)showErrAlert {
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"网络错误" message:nil preferredStyle:UIAlertControllerStyleAlert];
[alert addAction:[UIAlertAction actionWithTitle:@"重试" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
[self getSystemBaseConfigRequest];
}]];
[self presentViewController:alert animated:YES completion:nil];
}
#pragma mark -
- (void)initRongYun {
if (BJUserManager.userInfo.uid.length > 0) {
//
[BJUserManager bj_refreshUserInfo:nil];
}
}
- (void)goLoginOrHome {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
if (GVUSER.token.length > 0) {
[[NSNotificationCenter defaultCenter] postNotificationName:kLoginSucessNotification object:nil];
}else{
dispatch_async(dispatch_get_main_queue(), ^{
[APPDELEGATE setupLoginViewController];
});
}
});
}
@end

View File

@@ -0,0 +1,22 @@
//
// AFNetworkRequset.h
// JiushiMarking
//
// Created by 小收 on 2019/8/16.
// Copyright © 2019 小收. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface AFNetworkRequset : NSObject
+ (instancetype)shared;
///项目统一的网络请求使用默认baseURL
- (void)postRequestWithParams:(nullable NSDictionary *)params Path:(NSString *)path Loading:(BOOL)loading Hud:(BOOL)showHud Success:(void(^)(id responseDic))success Failure:(void(^)(id errorData))failure;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,95 @@
//
// AFNetworkRequset.m
// JiushiMarking
//
// Created by on 2019/8/16.
// Copyright © 2019 . All rights reserved.
//
#import "AFNetworkRequset.h"
#import "MainNavigationController.h"
#import "HelpPageDefine.h"
@interface AFNetworkRequset()
{
BOOL netWorkStatus;
}
@end
@implementation AFNetworkRequset
+ (instancetype)shared{
static AFNetworkRequset *networkRequest = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
networkRequest = [[AFNetworkRequset alloc]init];
});
return networkRequest;
}
- (void)postRequestWithParams:(nullable NSDictionary *)params Path:(NSString *)path Loading:(BOOL)loading Hud:(BOOL)showHud Success:(void(^)(id responseDic))success Failure:(void(^)(id errorData))failure {
if (loading) {
[SVProgressHUD show];
}
NSString *fullUrl = [NSString stringWithFormat:@"%@%@", VERSION_HTTPS_SERVER, path];
AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
NSMutableURLRequest *request = [[AFJSONRequestSerializer serializer] requestWithMethod:@"POST" URLString:fullUrl parameters:nil error:nil];
request.timeoutInterval = 10;
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
//
NSString *timestamp = [BJEncryptionTool getNowTimeTimestamp];
NSString *app_sign = [BJEncryptionTool getSignWith:timestamp];
[request setValue:C_string(timestamp) forHTTPHeaderField:@"timestamp"];
[request setValue:C_string(app_sign) forHTTPHeaderField:@"app-sign"];
NSMutableDictionary *mDict = [NSMutableDictionary dictionaryWithDictionary:params];
if (GVUSER.token.length > 0) {
[mDict setValue:GVUSER.token forKey:@"login_token"];
}
if (mDict != nil) {
[request setHTTPBody:mDict.mj_JSONData];
}
manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"text/html", @"text/plain", @"application/json", @"text/json", @"text/javascript", nil];
NSLog(@"请求参数: %@", mDict);
NSLog(@"请求地址: %@", fullUrl);
[[manager dataTaskWithRequest:request uploadProgress:^(NSProgress * _Nonnull uploadProgress) {
} downloadProgress:^(NSProgress * _Nonnull downloadProgress) {
} completionHandler:^(NSURLResponse * _Nonnull response, id _Nullable responseObject, NSError * _Nullable error) {
[SVProgressHUD dismiss];
NSLog(@"请求结果: %@", responseObject);
if (responseObject) {
NSString *code = [NSString stringWithFormat:@"%@", responseObject[@"code"]];
if ([code isEqualToString:@"200"]) {
if ([responseObject[@"data"] isKindOfClass:[NSNull class]]) {
success(@{});
}else {
success(responseObject);
}
if (showHud == YES && responseObject[@"msg"] != nil ){
[HelpPageDefine showMessage:responseObject[@"msg"]];
}
} else {
NSError *error = [NSError errorWithDomain:@"" code:1000 userInfo:nil];
failure(error);
if (responseObject[@"msg"] != nil){
[HelpPageDefine showMessage:responseObject[@"msg"]];
}
if ([responseObject[@"code"] integerValue] == 301) {
// token
[HelpPageDefine showMessage:@"登录失效,请重新登录"];
[APPDELEGATE setupLoginViewController];
}
}
}else {
[HelpPageDefine showMessage:@"请求失败"];
NSLog(@"请求错误: %@", error);
}
}] resume];
}
@end

View File

@@ -0,0 +1,33 @@
//
// HelpPageDefine.h
// LiveChat
//
// Created by 码农教育6 on 2018/10/22.
// Copyright © 2018年 manongjiaoyu. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface HelpPageDefine : NSObject
/**
* 提示信息
* @time 1.5秒后消失
*/
+(void)showMessage:(NSString *)message;
+(void)showMessage:(NSString *)message duration:(double)time;
/**
* 菊花刷新及消失
* @subview 父视图
*/
- (void)creatActivityIndicatorView:(UIView *)subview;
- (void)stopActivityIndicatorView;
- (void)stopImageLoading;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,180 @@
//
// HelpPageDefine.m
// LiveChat
//
// Created by 6 on 2018/10/22.
// Copyright © 2018 manongjiaoyu. All rights reserved.
//
#import "HelpPageDefine.h"
//
#define CURRENT_SIZE(size) (size)
@interface HelpPageDefine ()<CAAnimationDelegate>
@property (nonatomic, strong)UIActivityIndicatorView *activityIndicator;
@property (nonatomic, strong)UIView *backgroundView;
@property (nonatomic, strong)UIView *bottomView;
@property (nonatomic, strong)UIImageView *imageLoading;
@end
@implementation HelpPageDefine
+(void)showMessage:(NSString *)message
{
if (message == nil) {
message = @"";
}
CGSize screenSize = [[UIScreen mainScreen] bounds].size;
UIWindow * window = [UIApplication sharedApplication].keyWindow;
UIView *showview = [[UIView alloc]init];
showview.backgroundColor = [UIColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:0.75];
showview.frame = CGRectMake(1, 1, 1, 1);
showview.layer.cornerRadius = 8.0f;
showview.layer.masksToBounds = YES;
[window addSubview:showview];
UILabel *label = [[UILabel alloc]init];
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc]init];
paragraphStyle.lineBreakMode = NSLineBreakByWordWrapping;
NSDictionary *attributes = @{NSFontAttributeName:[UIFont systemFontOfSize:CURRENT_SIZE(15)],
NSParagraphStyleAttributeName:paragraphStyle.copy};
CGSize labelSize = [message boundingRectWithSize:CGSizeMake(ScreenWidth-CURRENT_SIZE(100), 999)
options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading
attributes:attributes context:nil].size;
CGFloat labelWidth = ceilf(labelSize.width);
CGFloat labelHeight = ceilf(labelSize.height);
label.text = message;
label.numberOfLines = 0;
label.textColor = [UIColor whiteColor];
label.textAlignment = NSTextAlignmentCenter;
label.backgroundColor = [UIColor clearColor];
label.font = [UIFont systemFontOfSize:CURRENT_SIZE(15)];
[showview addSubview:label];
showview.frame = CGRectMake((screenSize.width - labelWidth)/2-CURRENT_SIZE(50)/2,
(screenSize.height - (labelHeight+CURRENT_SIZE(20)))/2,
labelWidth+CURRENT_SIZE(50),
labelHeight+CURRENT_SIZE(20));
label.center = CGPointMake(showview.frame.size.width/2, showview.frame.size.height/2);
label.bounds = CGRectMake(0, 0, labelWidth, labelHeight);
[UIView animateWithDuration:1.5f animations:^{
showview.alpha = 0;
} completion:^(BOOL finished) {
[showview removeFromSuperview];
}];
}
+(void)showMessage:(NSString *)message duration:(double)time
{
if (message == nil) {
message = @"";
}
CGSize screenSize = [[UIScreen mainScreen] bounds].size;
UIWindow * window = [UIApplication sharedApplication].keyWindow;
UIView *showview = [[UIView alloc]init];
showview.backgroundColor = [UIColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:0.75];
showview.frame = CGRectMake(1, 1, 1, 1);
showview.layer.cornerRadius = 8.0f;
showview.layer.masksToBounds = YES;
[window addSubview:showview];
UILabel *label = [[UILabel alloc]init];
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc]init];
paragraphStyle.lineBreakMode = NSLineBreakByWordWrapping;
NSDictionary *attributes = @{NSFontAttributeName:[UIFont systemFontOfSize:CURRENT_SIZE(15)],
NSParagraphStyleAttributeName:paragraphStyle.copy};
CGSize labelSize = [message boundingRectWithSize:CGSizeMake(ScreenWidth-CURRENT_SIZE(100), 999)
options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading
attributes:attributes context:nil].size;
CGFloat labelWidth = ceilf(labelSize.width);
CGFloat labelHeight = ceilf(labelSize.height);
label.text = message;
label.numberOfLines = 0;
label.textColor = [UIColor whiteColor];
label.textAlignment = NSTextAlignmentCenter;
label.backgroundColor = [UIColor clearColor];
label.font = [UIFont systemFontOfSize:CURRENT_SIZE(15)];
[showview addSubview:label];
showview.frame = CGRectMake((screenSize.width - labelWidth)/2-CURRENT_SIZE(50)/2,
(screenSize.height - (labelHeight+CURRENT_SIZE(20)))/2,
labelWidth+CURRENT_SIZE(50),
labelHeight+CURRENT_SIZE(20));
label.center = CGPointMake(showview.frame.size.width/2, showview.frame.size.height/2);
label.bounds = CGRectMake(0, 0, labelWidth, labelHeight);
[UIView animateWithDuration:time animations:^{
showview.alpha = 0;
} completion:^(BOOL finished) {
[showview removeFromSuperview];
}];
}
//
- (void)creatActivityIndicatorView:(UIView *)subview
{
_bottomView = [[UIView alloc] init];
_bottomView.center = CGPointMake(ScreenWidth/2, ScreenHeight/2);
_bottomView.bounds = CGRectMake(0, 0, ScreenWidth, ScreenHeight);
_bottomView.backgroundColor = [UIColor blackColor];
_bottomView.alpha = 0.3;
[subview addSubview:_bottomView];
_backgroundView = [[UIView alloc] init];
_backgroundView.center = CGPointMake(ScreenWidth/2, ScreenHeight/2);
_backgroundView.bounds = CGRectMake(0, 0, 100, 100);
_backgroundView.backgroundColor = [UIColor blackColor];
_backgroundView.layer.masksToBounds = YES;
_backgroundView.layer.cornerRadius = 5;
//_backgroundView.alpha = 0.8;
[_bottomView addSubview:_backgroundView];
_activityIndicator = [[UIActivityIndicatorView alloc] init];
_activityIndicator.center =CGPointMake(_backgroundView.frame.size.width/2, _backgroundView.frame.size.height/2);
_activityIndicator.bounds = CGRectMake(0, 0, 40, 40);
_activityIndicator.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhite;
_activityIndicator.hidesWhenStopped = YES;
[_backgroundView addSubview:_activityIndicator];
[_activityIndicator startAnimating];
}
-(CABasicAnimation *)rotation:(float)dur direction:(int)direction repeatCount:(int)repeatCount
{
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
animation.toValue = [NSNumber numberWithFloat:M_PI * 2.0];
animation.duration = dur;
animation.autoreverses = NO;
animation.cumulative = YES;
animation.fillMode = kCAFillModeForwards;
animation.repeatCount = repeatCount;
animation.removedOnCompletion = NO;
animation.fillMode = kCAFillModeForwards;
animation.delegate = self;
return animation;
}
- (void)stopImageLoading{
[_imageLoading stopAnimating];
[_imageLoading removeFromSuperview];
}
- (void)stopActivityIndicatorView{
if ([_activityIndicator isAnimating]) {
[_activityIndicator stopAnimating];
}
[_backgroundView removeFromSuperview];
[_bottomView removeFromSuperview];
}
@end

View File

@@ -0,0 +1,24 @@
//
// MSCommonTool.h
// misheng
//
// Created by bj_szd on 2022/10/19.
// Copyright © 2022 syllable interactive. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "BRPickerView.h"
NS_ASSUME_NONNULL_BEGIN
@interface MSCommonTool : NSObject
+ (BRPickerStyle *)customPickerViewUI;
+ (UIImage *)convertViewToImage:(UIView *)view;
+ (void)saveImage:(UIImage *)image assetCollectionName:(NSString *)collectionName;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,112 @@
//
// MSCommonTool.m
// misheng
//
// Created by bj_szd on 2022/10/19.
// Copyright © 2022 syllable interactive. All rights reserved.
//
#import "MSCommonTool.h"
@implementation MSCommonTool
+ (BRPickerStyle *)customPickerViewUI {
BRPickerStyle *style = [[BRPickerStyle alloc] init];
style.selectedColor = [UIColor whiteColor];
style.topCornerRadius = 10;
style.hiddenShadowLine = YES;
style.hiddenTitleLine = YES;
style.hiddenTitleLabel = YES;
style.titleBarColor = HEXCOLOR(0xF5F7F7);
style.cancelTextColor = HEXCOLOR(0x999999);
style.cancelTextFont = [UIFont boldSystemFontOfSize:16];
style.cancelBtnFrame = CGRectMake(0, 0, 60, 50);
style.cancelBtnTitle = @"取消";
style.doneTextColor = mainDeepColor;
style.doneTextFont = [UIFont boldSystemFontOfSize:16];
style.doneBtnFrame = CGRectMake(SCREEN_WIDTH-60, 0, 60, 50);
style.doneBtnTitle = @"确定";
style.separatorColor = [UIColor clearColor];
style.pickerTextColor = HEXCOLOR(0x333333);
style.pickerTextFont = [UIFont systemFontOfSize:16];
style.pickerColor = HEXCOLOR(0xF5F7F7);;
style.rowHeight = 44;
return style;
}
+ (UIImage *)convertViewToImage:(UIView *)view{
CGSize size = view.bounds.size;
//NOYES
UIGraphicsBeginImageContextWithOptions(size, NO, [UIScreen mainScreen].scale);
[view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage*image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}
+ (void)saveImage:(UIImage *)image assetCollectionName:(NSString *)collectionName {
// 1. App
PHAuthorizationStatus authorizationStatus = [PHPhotoLibrary authorizationStatus];
// 2.
if (authorizationStatus == PHAuthorizationStatusAuthorized) {
// 2.1 , (2)
[self saveImage:image toCollectionWithName:collectionName];
} else if (authorizationStatus == PHAuthorizationStatusNotDetermined) { // , ,
[PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus status) {
// ,
if (status == PHAuthorizationStatusAuthorized) {
[self saveImage:image toCollectionWithName:collectionName];
}
}];
} else {
[HelpPageDefine showMessage:@"请在设置界面, 授权访问相册"];
}
}
//
+ (void)saveImage:(UIImage *)image toCollectionWithName:(NSString *)collectionName {
// 1.
PHPhotoLibrary *library = [PHPhotoLibrary sharedPhotoLibrary];
// 2. changeBlock
[library performChanges:^{
// 2.1
PHAssetCollectionChangeRequest *collectionRequest;
// 2.2
PHAssetCollection *assetCollection = [self getCurrentPhotoCollectionWithTitle:collectionName];
// 2.3
if (assetCollection) { // 使
collectionRequest = [PHAssetCollectionChangeRequest changeRequestForAssetCollection:assetCollection];
} else { // ,
collectionRequest = [PHAssetCollectionChangeRequest creationRequestForAssetCollectionWithTitle:collectionName];
}
// 2.4 ,
PHAssetChangeRequest *assetRequest = [PHAssetChangeRequest creationRequestForAssetFromImage:image];
// 2.4
PHObjectPlaceholder *placeholder = [assetRequest placeholderForCreatedAsset];
// 2.5
[collectionRequest addAssets:@[placeholder]];
} completionHandler:^(BOOL success, NSError * _Nullable error) {
// 3. , ,
dispatch_async(dispatch_get_main_queue(), ^{
if (error) {
[HelpPageDefine showMessage:@"保存失败"];
} else {
[HelpPageDefine showMessage:@"保存成功"];
}
});
}];
}
+ (PHAssetCollection *)getCurrentPhotoCollectionWithTitle:(NSString *)collectionName {
// 1.
PHFetchResult *result = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeAlbum subtype:PHAssetCollectionSubtypeAlbumRegular options:nil];
// 2.
for (PHAssetCollection *assetCollection in result) {
if ([assetCollection.localizedTitle containsString:collectionName]) {
return assetCollection;
}
}
return nil;
}
@end

View File

@@ -0,0 +1,44 @@
//
// UILabel+ChangeSpace.h
// romantic
//
// Created by bj_szd on 2022/4/9.
// Copyright © 2022 romantic. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface UILabel (ChangeSpace)
- (void)topAlignment;
- (void)bottomAlignment;
/**
* 改变行间距
*/
+ (void)changeLineSpaceForLabel:(UILabel *)label WithSpace:(float)space;
/**
* 改变字间距
*/
+ (void)changeWordSpaceForLabel:(UILabel *)label WithSpace:(float)space;
/**
* 改变行间距和字间距
*/
+ (void)changeSpaceForLabel:(UILabel *)label withLineSpace:(float)lineSpace WordSpace:(float)wordSpace;
/**
改变label文字中某段文字的颜色大小
label 传入label传入前要有文字
oneW 从第一个文字开始
size 尺寸
*/
- (void)LabelAttributedString:(UILabel*)label firstW:(NSString *)oneW size:(CGFloat)size;
+ (CGFloat)textHeight:(NSString *)text font:(UIFont *)font width:(CGFloat)width lineSpace:(CGFloat)lineSpace;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,120 @@
//
// UILabel+ChangeSpace.m
// romantic
//
// Created by bj_szd on 2022/4/9.
// Copyright © 2022 romantic. All rights reserved.
//
#import "UILabel+ChangeSpace.h"
@implementation UILabel (ChangeSpace)
+ (void)changeLineSpaceForLabel:(UILabel *)label WithSpace:(float)space {
NSString *labelText = label.text;
if (labelText == nil) {
return;
}
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:labelText];
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
paragraphStyle.alignment = NSTextAlignmentJustified;//
[paragraphStyle setLineSpacing:space];
[attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [labelText length])];
label.attributedText = attributedString;
// [label sizeToFit];
}
+ (void)changeWordSpaceForLabel:(UILabel *)label WithSpace:(float)space {
NSString *labelText = label.text;
if (labelText == nil) {
return;
}
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:labelText attributes:@{NSKernAttributeName:@(space)}];
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
[attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [labelText length])];
label.attributedText = attributedString;
[label sizeToFit];
}
+ (void)changeSpaceForLabel:(UILabel *)label withLineSpace:(float)lineSpace WordSpace:(float)wordSpace {
NSString *labelText = label.text;
if (labelText == nil) {
return;
}
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:labelText attributes:@{NSKernAttributeName:@(wordSpace)}];
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
[paragraphStyle setLineSpacing:lineSpace];
[attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [labelText length])];
label.attributedText = attributedString;
[label sizeToFit];
}
/**
label
label label
oneW
twoW
color
size
*/
- (void)LabelAttributedString:(UILabel*)label firstW:(NSString *)oneW size:(CGFloat)size {
// Attributed
NSMutableAttributedString *noteStr = [[NSMutableAttributedString alloc] initWithString:label.text];
//
NSRange range = [[noteStr string] rangeOfString:oneW];
//
[noteStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:size] range:range];
// labelAttributed
[label setAttributedText:noteStr];
}
// label
- (void)bottomAlignment
{
CGSize size = [self.text sizeWithAttributes:@{NSFontAttributeName:self.font}];
CGRect rect = [self.text boundingRectWithSize:CGSizeMake(self.frame.size.width, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:self.font} context:nil];
self.numberOfLines = 0;
NSInteger newLinesToPad = (self.frame.size.height - rect.size.height)/size.height;
for (NSInteger i = 0; i < newLinesToPad; i ++) {
self.text = [NSString stringWithFormat:@" \n%@",self.text];
}
}
// label
- (void)topAlignment
{
CGSize size = [self.text sizeWithAttributes:@{NSFontAttributeName:self.font}];
CGRect rect = [self.text boundingRectWithSize:CGSizeMake(self.frame.size.width, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:self.font} context:nil];
self.numberOfLines = 0;
NSInteger newLinesToPad = (self.frame.size.height - rect.size.height)/size.height;
for (NSInteger i = 0; i < newLinesToPad; i ++) {
self.text = [self.text stringByAppendingString:@"\n "];
}
}
+ (CGFloat)textHeight:(NSString *)text font:(UIFont *)font width:(CGFloat)width lineSpace:(CGFloat)lineSpace {
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
paragraphStyle.lineBreakMode = NSLineBreakByCharWrapping;
paragraphStyle.lineSpacing = lineSpace;
//Attributelabel
NSDictionary * attributes = @{
NSFontAttributeName:font,
NSParagraphStyleAttributeName: paragraphStyle
};
//sizewidthlabelMAXFLOAT
CGSize textRect = CGSizeMake(width, MAXFLOAT);
CGFloat textHeight = [text boundingRectWithSize: textRect
options:NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading
attributes:attributes
context:nil].size.height;
return textHeight;
}
@end

View File

@@ -0,0 +1,25 @@
//
// UITextView+ZWPlaceHolder.h
// ZWPlaceHolderDemo
//
// Created by 王子武 on 2017/6/6.
// Copyright © 2017年 wang_ziwu. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UITextView (ZWPlaceHolder)
/**
* UITextView+placeholder
*/
@property (nonatomic, copy) NSString *zw_placeHolder;
/**
* IQKeyboardManager等第三方框架会读取placeholder属性并创建UIToolbar展示
*/
@property (nonatomic, copy) NSString *placeholder;
/**
* placeHolder颜色
*/
@property (nonatomic, strong) UIColor *zw_placeHolderColor;
@end

View File

@@ -0,0 +1,102 @@
//
// UITextView+ZWPlaceHolder.m
// ZWPlaceHolderDemo
//
// Created by on 2017/6/6.
// Copyright © 2017 wang_ziwu. All rights reserved.
//
#import "UITextView+ZWPlaceHolder.h"
#import <objc/runtime.h>
static const void *zw_placeHolderKey;
@interface UITextView ()
@property (nonatomic, readonly) UILabel *zw_placeHolderLabel;
@end
@implementation UITextView (ZWPlaceHolder)
+(void)load{
[super load];
method_exchangeImplementations(class_getInstanceMethod(self.class, NSSelectorFromString(@"layoutSubviews")),
class_getInstanceMethod(self.class, @selector(zwPlaceHolder_swizzling_layoutSubviews)));
method_exchangeImplementations(class_getInstanceMethod(self.class, NSSelectorFromString(@"dealloc")),
class_getInstanceMethod(self.class, @selector(zwPlaceHolder_swizzled_dealloc)));
method_exchangeImplementations(class_getInstanceMethod(self.class, NSSelectorFromString(@"setText:")),
class_getInstanceMethod(self.class, @selector(zwPlaceHolder_swizzled_setText:)));
}
#pragma mark - swizzled
- (void)zwPlaceHolder_swizzled_dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
[self zwPlaceHolder_swizzled_dealloc];
}
- (void)zwPlaceHolder_swizzling_layoutSubviews {
if (self.zw_placeHolder) {
UIEdgeInsets textContainerInset = self.textContainerInset;
CGFloat lineFragmentPadding = self.textContainer.lineFragmentPadding;
CGFloat x = lineFragmentPadding + textContainerInset.left + self.layer.borderWidth;
CGFloat y = textContainerInset.top + self.layer.borderWidth;
CGFloat width = CGRectGetWidth(self.bounds) - x - textContainerInset.right - 2*self.layer.borderWidth;
CGFloat height = [self.zw_placeHolderLabel sizeThatFits:CGSizeMake(width, 0)].height;
self.zw_placeHolderLabel.frame = CGRectMake(x, y, width, height);
}
[self zwPlaceHolder_swizzling_layoutSubviews];
}
- (void)zwPlaceHolder_swizzled_setText:(NSString *)text{
[self zwPlaceHolder_swizzled_setText:text];
if (self.zw_placeHolder) {
[self updatePlaceHolder];
}
}
#pragma mark - associated
-(NSString *)zw_placeHolder{
return objc_getAssociatedObject(self, &zw_placeHolderKey);
}
-(void)setZw_placeHolder:(NSString *)zw_placeHolder{
objc_setAssociatedObject(self, &zw_placeHolderKey, zw_placeHolder, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
[self updatePlaceHolder];
}
-(UIColor *)zw_placeHolderColor{
return self.zw_placeHolderLabel.textColor;
}
-(void)setZw_placeHolderColor:(UIColor *)zw_placeHolderColor{
self.zw_placeHolderLabel.textColor = zw_placeHolderColor;
}
-(NSString *)placeholder{
return self.zw_placeHolder;
}
-(void)setPlaceholder:(NSString *)placeholder{
self.zw_placeHolder = placeholder;
}
#pragma mark - update
- (void)updatePlaceHolder{
if (self.text.length) {
[self.zw_placeHolderLabel removeFromSuperview];
return;
}
self.zw_placeHolderLabel.font = self.font?self.font:self.cacutDefaultFont;
self.zw_placeHolderLabel.textAlignment = self.textAlignment;
self.zw_placeHolderLabel.text = self.zw_placeHolder;
[self insertSubview:self.zw_placeHolderLabel atIndex:0];
}
#pragma mark - lazzing
-(UILabel *)zw_placeHolderLabel{
UILabel *placeHolderLab = objc_getAssociatedObject(self, @selector(zw_placeHolderLabel));
if (!placeHolderLab) {
placeHolderLab = [[UILabel alloc] init];
placeHolderLab.numberOfLines = 0;
placeHolderLab.textColor = [UIColor lightGrayColor];
objc_setAssociatedObject(self, @selector(zw_placeHolderLabel), placeHolderLab, OBJC_ASSOCIATION_RETAIN);
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updatePlaceHolder) name:UITextViewTextDidChangeNotification object:self];
}
return placeHolderLab;
}
- (UIFont *)cacutDefaultFont{
static UIFont *font = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
UITextView *textview = [[UITextView alloc] init];
textview.text = @" ";
font = textview.font;
});
return font;
}
@end

View File

@@ -0,0 +1,20 @@
//
// AppDelegate.h
// qingqiyuyin
//
// Created by bj_szd on 2022/1/18.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@property (nonatomic, copy) NSString *registEnterRid;//新用户登录后
//跳转登录页面
-(void)setupLoginViewController;
@end

View File

@@ -0,0 +1,172 @@
//
// AppDelegate.m
// qingqiyuyin
//
// Created by bj_szd on 2022/1/18.
//
#import "AppDelegate.h"
#import "SPLaunchVC.h"
#import "SATabBarVC.h"
#import <Bugly/Bugly.h>
#import "MLNetWorkHelper.h"
#import "BJFloatRoomManager.h"
#import "MainNavigationController.h"
#import <BMKLocationkit/BMKLocationComponent.h>
#import <WXApi.h>
#import <AlipaySDK/AlipaySDK.h>
#import <ShareSDK/ShareSDK.h>
#import <CL_ShanYanSDK/CL_ShanYanSDK.h>
#import "TXMicIMService.h"
#import "BJAgoraRtmManager.h"
#import "AvoidCrash.h"
#if DEBUG
#import <LLDebugTool.h>
#endif
@interface AppDelegate () <WXApiDelegate>
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[self initThird];
[self initOthers];
#if DEBUG
[[LLDebugTool sharedTool] startWorking];
#endif
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.backgroundColor = [UIColor whiteColor];
MainNavigationController *nav = [[MainNavigationController alloc] initWithRootViewController:[SPLaunchVC new]];
self.window.rootViewController = nav;
[self.window makeKeyAndVisible];
return YES;
}
- (void)initThird {
[Bugly startWithAppId:@"4aae33d1b1"];
//masonry
[[NSUserDefaults standardUserDefaults] setValue:@(NO) forKey:@"_UIConstraintBasedLayoutLogUnsatisfiable"];
// [[BMKLocationAuth sharedInstance] setAgreePrivacy:YES];
// [[BMKLocationAuth sharedInstance] checkPermisionWithKey:Baidu_AK authDelegate:self];
// [CLShanYanSDKManager initWithAppId:SHANYAN_APP_ID complete:nil];
//
[WXApi registerApp:WX_APP_ID universalLink:MOB_Universal_Link];
// [ShareSDK registPlatforms:^(SSDKRegister *platformsRegister) {
// [platformsRegister setupWeChatWithAppId:WX_APP_ID appSecret:WX_APP_KEY universalLink:MOB_Universal_Link];
// [platformsRegister setupQQWithAppId:QQ_APP_ID appkey:QQ_APP_KEY enableUniversalLink:YES universalLink:MOB_Universal_Link];
// }];
//
[AvoidCrash becomeEffective];
}
- (void)initOthers {
if (@available(iOS 11.0, *)){
[[UIScrollView appearance] setContentInsetAdjustmentBehavior:UIScrollViewContentInsetAdjustmentNever];
}
if (@available(iOS 15.0, *)) {
[UITableView appearance].sectionHeaderTopPadding = 0;
[UITableView appearance].prefetchingEnabled = NO;
}
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(loginRefresh) name:kLoginSucessNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(kickedOffLineAction) name:TXIMDinghaoNoti object:nil];
}
#pragma mark -
- (void)kickedOffLineAction {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
//线
[[NSNotificationCenter defaultCenter] postNotificationName:@"stopPlayYinyue" object:nil];
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"下线通知" message:@"您的账号在别的设备登录,您已被迫下线" preferredStyle:UIAlertControllerStyleAlert];
[alertController addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
dispatch_async(dispatch_get_main_queue(), ^{
[APPDELEGATE setupLoginViewController];
});
[BJFloatRoomManager.sharedBJFloatRoomManager closeFloatWindow];
// [[RCIMClient sharedRCIMClient] logout];
[BJUserManager clearUserInfo];
[MLRoomInformationManager clearUserInfo];
}]];
// modal
[self.window.rootViewController presentViewController:alertController animated:YES completion:nil];
});
}
#pragma mark -
- (void)loginRefresh {
//IM
[[TXMicIMService sharedService] initTXIMWithAppID:[GVUSER.tencentyun_im_appid intValue] userID:BJUserManager.userInfo.uid userSig:BJUserManager.userInfo.user_sig];
// //
// [[RCMicAppService sharedService] configUserEnvironment:BJUserManager.userInfo];
__weak typeof(self) weakSelf = self;
dispatch_async(dispatch_get_main_queue(), ^{
SATabBarVC *mainVC = SATabBarVC.sharedSATabBarVC;
weakSelf.window.rootViewController = mainVC;
});
}
//
-(void)setupLoginViewController{
[BJUserManager clearUserInfo];
[[BJAgoraRtmManager shared] logoutAndLeaveChannel];
// [[RCIMClient sharedRCIMClient] logout];
[UIViewController.currentViewController.navigationController popToRootViewControllerAnimated:YES];
SATabBarVC.sharedSATabBarVC.selectedIndex = 0;
if ([UIViewController.currentViewController isKindOfClass:SPLoginVC.class]) {
return;
}
// if ([UIViewController.currentViewController isKindOfClass:MH_ForgetVC.class]) {
// return;
// }
SPLoginVC *vc = [[SPLoginVC alloc] init];
MainNavigationController *navVC = [[MainNavigationController alloc] initWithRootViewController:vc];
self.window.rootViewController = navVC;
}
#pragma mark ----------------
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString*, id> *)options
{
//
if ([url.host isEqualToString:@"safepay"]) {
[[AlipaySDK defaultService] processOrderWithPaymentResult:url standbyCallback:nil];
}else{
[WXApi handleOpenURL:url delegate:self];
}
return YES;
}
-(void)onResp:(BaseResp*)resp{
if ([resp isKindOfClass:[PayResp class]]){
PayResp *response=(PayResp*)resp;
switch(response.errCode){
case WXSuccess:
[[NSNotificationCenter defaultCenter] postNotificationName:@"wechatPayResult" object:@"1"];
break;
case WXErrCodeUserCancel:
[[NSNotificationCenter defaultCenter] postNotificationName:@"wechatPayResult" object:@"2"];
break;
default:
[[NSNotificationCenter defaultCenter] postNotificationName:@"wechatPayResult" object:@"3"];
break;
}
}
}
@end

View File

@@ -0,0 +1,45 @@
//
// BJPassData.h
// QiaoYuYueWan
//
// Created by ybb on 2021/4/8.
// Copyright © 2021 QiaoYuYueWan. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface BJPassData : NSObject
@property (nonatomic, assign) NSInteger boxValue_1, boxValue_2, boxValue_3, boxValue_4, boxValue_5, boxValue_6;
singleton_interface(BJPassData)
/// 房间大类型
+ (void)refreshRoomBigTypeArr:(void(^)(NSArray *cateArr))cateBlock;
/// 拿到当前的房间类型
/// @param cateBlock 回调
+ (void)refreshRoomSubType:(NSString *)subId finish:(void(^)(NSArray *cateArr))cateBlock;
+ (void)refreshLimaoRoomSubTypeWithRid:(NSString *)rId finish:(void(^)(NSArray *cateArr))cateBlock;
/// 拿到房间背景图列表
/// @param imgArrBlock 回调
+ (void)refreshRoomBgArr:(void(^)(NSArray *imgArr))imgArrBlock;
/*
"gid": 2,
"game_name": "\u82f1\u96c4\u8054\u76df",
"game_ico": "http:\/\/cdn.guduxingqiu.cloud\/game_icon\/20210427\/ae3bdf83305d9cced431209574c29db8.png",
"sort": 4,
"status": 0
*/
- (void)getGameList:(void(^)(NSArray<NSDictionary *> *gameArr))imgArrBlock;
/// 提前获取宝箱价值
+ (void)refreshBoxList:(nullable void(^)(NSArray *listArr))finishBlock;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,155 @@
//
// BJPassData.m
// QiaoYuYueWan
//
// Created by ybb on 2021/4/8.
// Copyright © 2021 QiaoYuYueWan. All rights reserved.
//
#import "BJPassData.h"
@interface BJPassData ()
///
@property (nonatomic, strong) NSArray<NSDictionary *> *gamelist;
@end
@implementation BJPassData
singleton_implementation(BJPassData)
+ (void)refreshRoomBigTypeArr:(void(^)(NSArray *cateArr))cateBlock {
NSDictionary *dict = @{@"tid":@"4"};
NSMutableDictionary *paras = [NSMutableDictionary dictionary];
[paras addEntriesFromDictionary:dict];
// [SVProgressHUD showWithStatus:nil];
[RCMicHTTP postWithURLString:@"/api/room/get_room_type" parameters:paras response:^(RCMicHTTPResult *result) {
// [SVProgressHUD dismiss];
if (result.success) {
if (result.errorCode == 200 && [result.content isKindOfClass:NSArray.class]) {
cateBlock? cateBlock(result.content) : nil;
}else {
[SVProgressHUD showInfoWithStatus:result.message];
}
}else {
[SVProgressHUD showInfoWithStatus:@"网络错误"];
}
}];
}
+ (void)refreshRoomSubType:(NSString *)subId finish:(void(^)(NSArray *cateArr))cateBlock {
NSDictionary *dict = @{@"tid":C_string(subId)};
NSMutableDictionary *paras = [NSMutableDictionary dictionary];
[paras addEntriesFromDictionary:dict];
// [SVProgressHUD showWithStatus:nil];
[RCMicHTTP postWithURLString:@"/api/room/get_category_list" parameters:paras response:^(RCMicHTTPResult *result) {
// [SVProgressHUD dismiss];
if (result.success) {
if (result.errorCode == 200 && [result.content isKindOfClass:NSArray.class]) {
cateBlock? cateBlock(result.content) : nil;
}else {
[SVProgressHUD showInfoWithStatus:result.message];
}
}else {
[SVProgressHUD showInfoWithStatus:@"网络错误"];
}
}];
}
+ (void)refreshLimaoRoomSubTypeWithRid:(NSString *)rId finish:(void(^)(NSArray *cateArr))cateBlock {
NSDictionary *dict = @{@"rid":C_string(rId)};
NSMutableDictionary *paras = [NSMutableDictionary dictionary];
[paras addEntriesFromDictionary:dict];
// [SVProgressHUD showWithStatus:nil];
[RCMicHTTP postWithURLString:@"/api/room/get_power_room_cate" parameters:paras response:^(RCMicHTTPResult *result) {
// [SVProgressHUD dismiss];
if (result.success) {
if (result.errorCode == 200 && [result.content isKindOfClass:NSArray.class]) {
cateBlock? cateBlock(result.content) : nil;
}else {
[SVProgressHUD showInfoWithStatus:result.message];
}
}else {
[SVProgressHUD showInfoWithStatus:@"网络错误"];
}
}];
}
+ (void)refreshRoomBgArr:(void(^)(NSArray *imgArr))imgArrBlock {
NSDictionary *dict = @{};
NSMutableDictionary *paras = [NSMutableDictionary dictionary];
[paras addEntriesFromDictionary:dict];
// [SVProgressHUD showWithStatus:nil];
[RCMicHTTP postWithURLString:@"/api/room/get_room_background_list" parameters:paras response:^(RCMicHTTPResult *result) {
// [SVProgressHUD dismiss];
if (result.success) {
if (result.errorCode == 200 && [result.content isKindOfClass:NSArray.class]) {
imgArrBlock? imgArrBlock(result.content) : nil;
}else {
[SVProgressHUD showInfoWithStatus:result.message];
}
}else {
[SVProgressHUD showInfoWithStatus:@"网络错误"];
}
}];
}
- (void)getGameList:(void(^)(NSArray<NSDictionary *> *gameArr))imgArrBlock {
if (_gamelist.count > 0) {
imgArrBlock? imgArrBlock(_gamelist.copy) : nil;
return;
}
[SVProgressHUD showWithStatus:nil];
[RCMicHTTP postWithURLString:@"/api/player/get_player_game_list" parameters:nil response:^(RCMicHTTPResult *result) {
[SVProgressHUD dismiss];
if (result.success) {
if (result.errorCode == 200 && [result.content isKindOfClass:NSArray.class]) {
self.gamelist = result.content;
imgArrBlock? imgArrBlock(self.gamelist.copy) : nil;
}else {
[SVProgressHUD showInfoWithStatus:result.message];
}
}else {
[SVProgressHUD showInfoWithStatus:@"网络错误"];
}
}];
}
+ (void)refreshBoxList:(void(^)(NSArray *listArr))finishBlock {
if (BJPassData.sharedBJPassData.boxValue_1 > 0) {
return;
}
// [SVProgressHUD showWithStatus:nil];
[RCMicHTTP postWithURLString:@"/api/box/get_box_type_list" parameters:nil response:^(RCMicHTTPResult *result) {
// [SVProgressHUD dismiss];
if (result.success) {
if (result.errorCode == 200 && [result.content isKindOfClass:NSArray.class]) {
NSArray *list = result.content;
if (list.count == 4) {
BJPassData.sharedBJPassData.boxValue_1 = [list[0] safeIntForKey:@"open_price"];
BJPassData.sharedBJPassData.boxValue_2 = [list[1] safeIntForKey:@"open_price"];
BJPassData.sharedBJPassData.boxValue_3 = [list[2] safeIntForKey:@"open_price"];
BJPassData.sharedBJPassData.boxValue_4 = [list[3] safeIntForKey:@"open_price"];
BJPassData.sharedBJPassData.boxValue_5 = [list[4] safeIntForKey:@"open_price"];
}
finishBlock? finishBlock(result.content) : nil;
}else {
[SVProgressHUD showInfoWithStatus:result.message];
}
}else {
[SVProgressHUD showInfoWithStatus:@"网络错误"];
}
}];
}
@end

View File

@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="23504" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23506"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="a_launch_qx" translatesAutoresizingMaskIntoConstraints="NO" id="hEQ-gm-w1p">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
</imageView>
</subviews>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="hEQ-gm-w1p" firstAttribute="top" secondItem="Ze5-6b-2t3" secondAttribute="top" id="H2L-El-Qoe"/>
<constraint firstItem="hEQ-gm-w1p" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leading" id="M1r-Qn-DUp"/>
<constraint firstAttribute="trailing" secondItem="hEQ-gm-w1p" secondAttribute="trailing" id="UPk-LQ-nFz"/>
<constraint firstAttribute="bottom" secondItem="hEQ-gm-w1p" secondAttribute="bottom" id="dcc-ci-lIi"/>
</constraints>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
<resources>
<image name="a_launch_qx" width="375" height="812"/>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources>
</document>

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
</scene>
</scenes>
</document>

View File

@@ -0,0 +1,4 @@
//
// Use this file to import your target's public headers that you would like to expose to Swift.
//

View File

@@ -0,0 +1,8 @@
//
// YYHelpful.swift
// SweetParty
//
// Created by MAC on 2024/3/21.
//
import Foundation

View File

@@ -0,0 +1,18 @@
//
// main.m
// SweetParty
//
// Created by bj_szd on 2022/5/30.
//
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
int main(int argc, char * argv[]) {
NSString * appDelegateClassName;
@autoreleasepool {
// Setup code that might create autoreleased objects goes here.
appDelegateClassName = NSStringFromClass([AppDelegate class]);
}
return UIApplicationMain(argc, argv, nil, appDelegateClassName);
}

View File

@@ -0,0 +1,22 @@
//
// BaseCell.h
// 君分时代
//
// Created by 贠小飞 on 2018/4/10.
// Copyright © 2018年 贠小飞. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "Global.h"
@class BaseController;
@interface BaseCell : UITableViewCell{
BaseUIStyle *_uiStyle;
}
@property (nonatomic, assign) BaseController *parentVC;
- (void)loadData:(id)obj;
+ (NSInteger)heightForCell:(id)obj;
@end

View File

@@ -0,0 +1,45 @@
//
// BaseCell.m
//
//
// Created by on 2018/4/10.
// Copyright © 2018 . All rights reserved.
//
#import "BaseCell.h"
@implementation BaseCell
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
_uiStyle = [[BaseUIStyle alloc] init];
self.selectionStyle = UITableViewCellSeparatorStyleNone;
// self.backgroundColor = _uiStyle.bgColor;
self.contentView.backgroundColor = _uiStyle.tableCellBgColor;
CGRect rect = CGRectMake(0.0f, self.height - 1, ScreenViewWidth, 1.0f);
[ControlCreator createView:self rect:rect backguoundColor:_uiStyle.tableSeparatorColor];
self.parentVC = nil;
}
return self;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated{
[super setSelected:selected animated:animated];
}
- (void)loadData:(id)obj{
}
+ (NSInteger)heightForCell:(id)obj{
return 44;
}
- (void)dealloc{
NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
[center removeObserver:self];
}
@end

View File

@@ -0,0 +1,83 @@
//
// BaseController.h
// 君分时代
//
// Created by 贠小飞 on 2018/4/10.
// Copyright © 2018年 贠小飞. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "BaseUIStyle.h"
#import "CustomNavigationView.h"
#import "NODataView.h"
@interface BaseController : UIViewController
#pragma mark - ybb添加
/// 导航栏文字,如果要使用自定义导航栏时:必需
@property (nonatomic, copy) NSString *navTitle;
/// 自定义导航栏
@property (nonatomic, strong) CustomNavigationView *customNavBar;
/// 当前页面是否在显示eg如收到通知判断当前页面在显示时才执行事件可用该值判断
@property (nonatomic, assign) BOOL viewOnShow;
/// 关闭IQKeyboard默认为NO
@property (nonatomic, assign) BOOL IQKeyboardDisable;
/// 一行代码设置头部标题并push出自己有自定义导航栏
/// @param title 标题
- (void)pushSelfWithTitle:(NSString *)title;
#pragma mark - 旧的
@property (nonatomic, strong) BaseUIStyle *uiStyle;
@property (nonatomic, strong) UIView *barView;
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UIButton *leftButton;
@property (nonatomic, strong) UIImageView *leftButtonView;
@property (nonatomic, strong) UILabel *leftTitleLabel;
@property (nonatomic, strong) UIButton *rightButton;
@property (nonatomic, strong) UIImageView *rightButtonView;
@property (nonatomic, strong) UILabel *rightTitleLabel;
@property (nonatomic, strong) UIView *bgView;
@property(nonatomic, assign) NSInteger bj_page;
//@property (nonatomic, assign) BOOL needBackground;
@property (nonatomic, assign) BOOL isNeedLine;
@property(nonatomic, strong) NODataView *emptyView;
@property(nonatomic, strong) UIScrollView *scrollView;
@property (nonatomic, strong) UITableView * BJ_tableView;
@property (nonatomic, strong) UICollectionView * BJ_collectionView;
@property(nonatomic, strong) NSMutableArray *BJ_dataArray;
//图片加文字,空视图
-(void)isShowEmptyViewWithArray:(NSArray *)ary;
- (void)loadBar:(BOOL)needBar needBack:(BOOL)needBack needBackground:(BOOL)beedBackground;
- (void)backClick;
- (void)rightButtonClick:(UIButton *)sender;
- (void)showMessage:(NSString *)message;
- (void)reloadData;
//显示小红点
- (void)showBadge;
//隐藏小红点
- (void)hideBadge;
#pragma mark - 加载框
- (void)showLoading;
- (void)dismissLoading;
/**
* 显示没有数据页面
*/
-(void)showNoDataImage;
/**
* 移除无数据页面
*/
-(void)removeNoDataImage;
@end

View File

@@ -0,0 +1,428 @@
//
// BaseController.m
//
//
// Created by on 2018/4/10.
// Copyright © 2018 . All rights reserved.
//
#import "BaseController.h"
#import "Global.h"
#import "UITabBar+Badge.h"
#import <IQKeyboardManager/IQKeyboardManager.h>
@interface BaseController () <UIGestureRecognizerDelegate>
@property (nonatomic,strong) UIImageView* noDataView;
@property (nonatomic, assign) BOOL viewHaveLoad;
@end
@implementation BaseController
- (id)init{
self = [super init];
if (self) {
[self initData];
}
return self;
}
- (void)initData{
_uiStyle = [[BaseUIStyle alloc] init];
_barView = nil;
_titleLabel = nil;
_leftButton = nil;
_leftButtonView = nil;
_leftTitleLabel = nil;
_rightButton = nil;
_rightButtonView = nil;
_rightTitleLabel = nil;
_isNeedLine = NO;
self.bj_page = 1;
self.navigationItem.hidesBackButton = YES;
self.BJ_dataArray = [NSMutableArray array];
[SVProgressHUD setMinimumDismissTimeInterval:2];
}
- (void)viewDidLoad {
[super viewDidLoad];
// [self initData];
self.modalPresentationStyle = UIModalPresentationFullScreen;
if (self.navTitle.length > 0) {
//使
[self.customNavBar cus_setNavTitle:_navTitle];
if (!self.customNavBar.superview) {
[self.view addSubview:self.customNavBar];
}
}
self.view.backgroundColor = UIColor.whiteColor;
_viewHaveLoad = YES;
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
//
BlackContentStatusBar
[self.view bringSubviewToFront:self.customNavBar];
self.navigationController.navigationBar.hidden = YES;
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
}
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
_viewOnShow = YES;
[self.view bringSubviewToFront:self.customNavBar];
//IQKeyboardManager
IQKeyboardManager *manager = IQKeyboardManager.sharedManager;
manager.enable = !self.IQKeyboardDisable;
// [BJPassData refreshBoxList:nil];
}
- (void)viewDidDisappear:(BOOL)animated {
_viewOnShow = NO;
[super viewDidDisappear:animated];
}
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
[self.view endEditing: YES];
}
- (void)dealloc{
[[NSNotificationCenter defaultCenter] removeObserver:self];
NSLog(@"销毁%@", NSStringFromClass(self.class));
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
- (UIView *)bgView {
return self.view;
}
#pragma mark -
- (void)pushSelfWithTitle:(NSString *)title {
self.navTitle = C_string(title);
if (UIViewController.currentViewController.navigationController) {
[UIViewController.currentViewController.navigationController pushViewController:self animated:YES];
}else {
[UIViewController.currentViewController presentViewController:self animated:YES completion:nil];
}
}
#pragma mark - set
- (CustomNavigationView *)customNavBar {
if (!_customNavBar) {
_customNavBar = [[CustomNavigationView alloc] initWithFrame:CGRectMake(0, 0, APPW, yb_NavigationBar_H)];
[_customNavBar cus_setNavShow:0];
}
return _customNavBar;
}
- (void)setNavTitle:(NSString *)navTitle {
_navTitle = navTitle;
[self.customNavBar cus_setNavTitle:navTitle];
//viewDidLoad
if (_viewHaveLoad) {
if (!self.customNavBar.superview) {
[self.view addSubview:self.customNavBar];
}
}
}
//
-(void)isShowEmptyViewWithArray:(NSArray *)ary{
if (ary.count == 0 ) {
[self.bgView addSubview:self.emptyView];
}else{
[self.emptyView removeFromSuperview];
}
}
- (NODataView *)emptyView{
if (!_emptyView) {
_emptyView = [[NODataView alloc] initWithFrame:CGRectMake(0, 200, ScreenWidth, 300)];
[_emptyView loadDataWithDic:@{@"imageName":@"no_data_Img",
@"title":@"这里什么都没有哦~"
}];
_emptyView.backgroundColor = kClearColor;
}
return _emptyView;
}
#pragma mark -
- (UIScrollView *)scrollView{
if (!_scrollView) {
_scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, ZJTopNavH, ScreenWidth, ScreenHeight-ZJTopNavH)];
_scrollView.showsVerticalScrollIndicator = NO;
_scrollView.backgroundColor = kClearColor;
}
return _scrollView;
}
- (UITableView *)BJ_tableView
{
if (_BJ_tableView == nil) {
_BJ_tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, ZJTopNavH, ScreenWidth, ScreenHeight - ZJTopNavH) style:UITableViewStylePlain];
_BJ_tableView.separatorInset = UIEdgeInsetsMake(0, 0, 0, 0);
_BJ_tableView.estimatedRowHeight = 0;
_BJ_tableView.estimatedSectionHeaderHeight = 0;
_BJ_tableView.estimatedSectionFooterHeight = 0;
if (@available(iOS 13.0, *)) {
_BJ_tableView.automaticallyAdjustsScrollIndicatorInsets = NO;
} else {
}
_BJ_tableView.showsVerticalScrollIndicator = NO;
_BJ_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
_BJ_tableView.backgroundColor=kClearColor;
// _BJ_tableView.scrollsToTop = YES;
_BJ_tableView.tableFooterView = [[UIView alloc] init];
}
return _BJ_tableView;
}
- (UICollectionView *)BJ_collectionView
{
if (_BJ_collectionView == nil) {
UICollectionViewFlowLayout *flow = [[UICollectionViewFlowLayout alloc] init];
_BJ_collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, ZJTopNavH, ScreenWidth , ScreenHeight - ZJTopNavH) collectionViewLayout:flow];
// MJRefreshNormalHeader *header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(headerRereshing)];
// header.automaticallyChangeAlpha = YES;
// header.lastUpdatedTimeLabel.hidden = YES;
// header.stateLabel.hidden = YES;
// _BJ_collectionView.mj_header = header;
//
// //
// _BJ_collectionView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(footerRereshing)];
//
_BJ_collectionView.backgroundColor=kClearColor;
_BJ_collectionView.scrollsToTop = YES;
}
return _BJ_collectionView;
}
-(void)headerRereshing{
}
-(void)footerRereshing{
}
- (void)loadBar:(BOOL)needBar needBack:(BOOL)needBack needBackground:(BOOL)beedBackground{
if (needBar) {
CGFloat width = ScreenViewWidth;
CGFloat height = _uiStyle.topBarHeight;
CGRect rect = CGRectMake(0.0f, 0.0f, width, height);
_barView = [ControlCreator createView:_bgView rect:rect backguoundColor:_uiStyle.topBarBgColor];
[self.view addSubview:_barView];
_barView.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin;
if (_isNeedLine) {
UIView *line = [ControlCreator createView:_barView rect:CGRectMake(0, height, width, 0.5) backguoundColor:MLControlsHuiColor];
[_barView addSubview:line];
}
//
CGFloat topMargin = ZJStatusBarH;
width = ScreenWidth;
height = _barView.height - topMargin;
rect = CGRectMake(0.0f, topMargin, width, height);
_titleLabel = [ControlCreator createLabel:_barView rect:rect text:nil font:_uiStyle.topBarTitleFont color:_uiStyle.topBarTitleColor backguoundColor:nil align:NSTextAlignmentCenter lines:0];
// -
width = 120.0f;
height = _barView.height - topMargin;
rect = CGRectMake(5.0f, topMargin, width, height);
if (needBack) {
_leftButton = [ControlCreator createButton:_barView rect:rect text:nil font:nil color:nil backguoundColor:nil imageName:nil target:self action:@selector(backClick)];
}else{
_leftButton = [ControlCreator createButton:_barView rect:rect text:nil font:nil color:nil backguoundColor:nil imageName:nil target:nil action:nil];
}
//
CGFloat leftMargin = 10.0f;
width = _leftButton.width - leftMargin;
height = _leftButton.height;
rect = CGRectMake(leftMargin, 0.0f, width, height);
_leftTitleLabel = [ControlCreator createLabel:_leftButton rect:rect text:nil font:_uiStyle.topBarButtionFont color:_uiStyle.topBarTitleColor backguoundColor:[UIColor clearColor] align:NSTextAlignmentLeft lines:0];
//
width = 20.0f;
height = 20.0f;
rect = CGRectMake((_leftButton.height - width)*0.5f, (_leftButton.height - height)*0.5f, width, height);
_leftButtonView.userInteractionEnabled = YES;
_leftButtonView = [[UIImageView alloc] initWithFrame:rect];
_leftButtonView.contentMode = UIViewContentModeCenter;
_leftButtonView.backgroundColor = [UIColor clearColor];
if (needBack) {
_leftButtonView.image = [UIImage imageNamed:@"xiaoxi_back"];
}
[_leftButton addSubview:_leftButtonView];
//
width = _leftButton.width;
height = _leftButton.height;
rect = CGRectMake(ScreenViewWidth - width - 5, topMargin, width, height);
_rightButton = [ControlCreator createButton:_barView rect:rect text:nil font:nil color:nil backguoundColor:[UIColor clearColor] imageName:nil target:self action:@selector(rightButtonClick:)];
//
width = _rightButton.width - leftMargin;
height = _rightButton.height;
rect = CGRectMake(0.0f, 0.0f, width, height);
_rightTitleLabel = [ControlCreator createLabel:_rightButton rect:rect text:nil font:_uiStyle.topBarButtionFont color:_uiStyle.topBarTitleColor backguoundColor:[UIColor clearColor] align:NSTextAlignmentRight lines:0];
_rightTitleLabel.adjustsFontSizeToFitWidth = YES;
width = _leftButtonView.width;
height = _leftButtonView.height;
rect = CGRectMake(_rightButton.width - width - (_rightButton.height - width) * 0.5f, (_rightButton.height - height) * 0.5f, width, height);
_rightButtonView = [[UIImageView alloc] initWithFrame:rect];
_rightButtonView.contentMode = UIViewContentModeCenter;
_rightButtonView.backgroundColor = [UIColor clearColor];
[_rightButton addSubview:_rightButtonView];
}
if (beedBackground) {
}
}
- (void)backClick{
[self resignAllResponder];
if (self.navigationController) {
[self.navigationController popViewControllerAnimated:YES];
}else{
[self dismissViewControllerAnimated:YES completion:nil];
}
}
- (void)rightButtonClick:(UIButton *)sender{
}
- (void)resignFieldResponder{
}
- (void)resignOtherViewResponder{
}
- (void)resignAllResponder{
[self resignFieldResponder];
[self resignOtherViewResponder];
}
#pragma mark -
- (void)showLoading
{
[MBProgressHUD showProgressToView:self.view Text:@"加载中..."];
}
-(void)showNoDataImage
{
_noDataView=[[UIImageView alloc] init];
[_noDataView setImage:[UIImage imageNamed:@"page_kong"]];
_noDataView.contentMode = UIViewContentModeScaleAspectFit;
[self.view.subviews enumerateObjectsUsingBlock:^(UITableView* obj, NSUInteger idx, BOOL *stop) {
if ([obj isKindOfClass:[UITableView class]]||[obj isKindOfClass:[UICollectionView class]]) {
[_noDataView setFrame:CGRectMake(ScreenWidth/2.0-81, ScreenHeight/2.0-87-ZJTopNavH,162, 154)];
[obj addSubview:_noDataView];
}
}];
}
-(void)removeNoDataImage{
if (_noDataView) {
[_noDataView removeFromSuperview];
_noDataView = nil;
}
}
- (void)dismissLoading
{
[MBProgressHUD hideHUDForView:self.view];
}
- (void)showMessage:(NSString *)message{
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil message:message delegate:nil cancelButtonTitle:nil otherButtonTitles:@"OK", nil];
[alertView show];
}
- (void)reloadData{
}
//
- (void)showBadge{
//
[self removeBadge];
//
UIView *badgeView = [[UIView alloc]init];
badgeView.userInteractionEnabled = YES;
badgeView.layer.cornerRadius = 2.5;//
badgeView.tag = 999;
badgeView.backgroundColor = [UIColor redColor];//
[self.rightButtonView addSubview:badgeView];
[badgeView mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.rightButtonView.mas_right).offset(0);
make.width.and.height.equalTo(@5);
make.top.equalTo(self.rightButton.mas_top).offset(5);
}];
}
//
- (void)hideBadge{
//
[self removeBadge];
}
//
- (void)removeBadge{
//tag
for (UIView *subView in self.rightButtonView.subviews) {
if (subView.tag == 999) {
[subView removeFromSuperview];
}
}
}
- (NSMutableArray *)BJ_dataArray{
if (!_BJ_dataArray) {
_BJ_dataArray = [NSMutableArray array];
}
return _BJ_dataArray;
}
@end

View File

@@ -0,0 +1,26 @@
//
// BaseView.h
// 君分时代
//
// Created by 贠小飞 on 2018/4/10.
// Copyright © 2018年 贠小飞. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "Global.h"
#import "BaseController.h"
@interface BaseView : UIView{
BaseUIStyle *_uiStyle;
}
@property (nonatomic, assign) BaseController *parentVC;
- (void)loadData:(id)obj;
+ (NSInteger)HeightForView;
+ (NSInteger)WidthForView;
@end

View File

@@ -0,0 +1,38 @@
//
// BaseView.m
//
//
// Created by on 2018/4/10.
// Copyright © 2018 . All rights reserved.
//
#import "BaseView.h"
@implementation BaseView
- (void)dealloc {
NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
[center removeObserver:self];
}
- (id)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
_uiStyle = [[BaseUIStyle alloc] init];
}
return self;
}
- (void)loadData:(id)obj {
}
+ (NSInteger)HeightForView {
return 0.0f;
}
+ (NSInteger)WidthForView {
return 0.0f;
}
@end

View File

@@ -0,0 +1,19 @@
//
// JianBianButton.h
// MoHuanXingYu
//
// Created by 翟三美 on 2020/6/14.
// Copyright © 2020 MoHuanXingYu. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface JianBianButton : UIButton
-(void)setJianBianWithCGSize:(CGSize)size;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,16 @@
//
// JianBianButton.m
// MoHuanXingYu
//
// Created by on 2020/6/14.
// Copyright © 2020 MoHuanXingYu. All rights reserved.
//
#import "JianBianButton.h"
@implementation JianBianButton
- (void)setJianBianWithCGSize:(CGSize)size{
[self gradientButtonWithSize:size colorArray:@[mHexRGB(0xFF5057),HEXCOLOR(0xFF5057)] percentageArray:@[@(0),@(1)] gradientType:GradientFromLeftToRight];
}
@end

View File

@@ -0,0 +1,17 @@
//
// MLStateView.h
// MoHuanXingYu
//
// Created by feifei on 2019/8/10.
// Copyright © 2019 MoHuanXingYu. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface MLStateView : UIView
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,36 @@
//
// MLStateView.m
// MoHuanXingYu
//
// Created by feifei on 2019/8/10.
// Copyright © 2019 MoHuanXingYu. All rights reserved.
//
#import "MLStateView.h"
@interface MLStateView ()
@property (nonatomic, strong) UIImageView *img;
@property (nonatomic, strong) UILabel *titelLB;
@end
@implementation MLStateView
//- (UIImageView *)img{
// if (!_img) {
// _img = [ControlCreator createImageView:nil rect:CGRectZero imageName:@"" backguoundColor:[UIColor clearColor]];
// }
// return _img;
//}
//- (UILabel *)titelLB{
// if (!_titelLB) {
// _titelLB = [ControlCreator createLabel:nil rect:CGRectZero text:@"" font:Font(12) color:[] backguoundColor:<#(UIColor *)#> align:<#(NSTextAlignment)#> lines:<#(NSInteger)#>];
// }
//}
@end

View File

@@ -0,0 +1,20 @@
//
// SATabBarVC.h
// SamaVoice
//
// Created by 申中迪 on 2022/5/8.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface SATabBarVC : UITabBarController
singleton_interface(SATabBarVC)
- (void)updateMsgDot;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,124 @@
//
// SATabBarVC.m
// SamaVoice
//
// Created by on 2022/5/8.
//
#import "SATabBarVC.h"
#import "UITabBar+Badge.h"
#import "MainNavigationController.h"
#import "SPCustomTabBar.h"
#import "SPHomeContainerVC.h"
#import "SPTrendContainerVC.h"
#import "SPPartyListVC.h"
#import "TXMessageVC.h"
#import "SPMineVC.h"
#import "TXMicIMService.h"
@interface SATabBarVC ()
@property (nonatomic, strong) SPCustomTabBar *coustomBar;
@end
@implementation SATabBarVC
singleton_implementation(SATabBarVC)
- (void)viewDidLoad {
[super viewDidLoad];
[self updateMsgDot];
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(updateMsgDot) name:TXIMUnreadMessageNoti object:nil];
}
- (void)updateMsgDot {
[[TXMicIMService sharedService] onGetUnreadCount:^(NSInteger count) {
if (count == 0) {
[self.tabBar hideBadgeOnItemIndex:2];
}else {
[self.tabBar showBadgeOnItemIndex:2 color:HEXCOLOR(0xFF5057) withCount:count];
}
}];
}
- (void)loadView {
[super loadView];
// //
self.coustomBar = [[SPCustomTabBar alloc] init];
UIImageView *bgImg = [[UIImageView alloc] initWithFrame:CGRectMake(15, 0, APPW-30, 50)];
bgImg.image = ImageNamed(@"tabbar_backIMG");
[self.coustomBar addSubview:bgImg];
[self.coustomBar.centerBtn addTarget:self action:@selector(onSweetParty) forControlEvents:UIControlEventTouchUpInside];
// //NOviewtabbarYES
self.coustomBar.translucent = NO;
// //KVC tabbartabBar
[self setValue:self.coustomBar forKeyPath:@"tabBar"];
SPPartyListVC *homeVC = [[SPPartyListVC alloc] init];
[self addPropertyToChildVC:homeVC image:[UIImage imageNamed:@"tab_home"] selectedImage:[UIImage imageNamed:@"tab_home_s"] title:@"首页"];
SPTrendContainerVC *dynamicVC = [[SPTrendContainerVC alloc] init];
[self addPropertyToChildVC:dynamicVC image:[UIImage imageNamed:@"tab_dynamic"] selectedImage:[UIImage imageNamed:@"tab_dynamic_s"] title:@"动态"];
TXMessageVC *msgVC = [[TXMessageVC alloc] init];
[self addPropertyToChildVC:msgVC image:[UIImage imageNamed:@"tab_msg"] selectedImage:[UIImage imageNamed:@"tab_msg_s"] title:@"消息"];
SPMineVC *mineVC = [[SPMineVC alloc] init];
[self addPropertyToChildVC:mineVC image:[UIImage imageNamed:@"tab_mine"] selectedImage:[UIImage imageNamed:@"tab_mine_s"] title:@"我的"];
}
- (void)onSweetParty {
self.selectedIndex = 2;
}
- (void)addPropertyToChildVC:(UIViewController *)VC image:(UIImage *)image selectedImage:(UIImage *)selectedImage title:(NSString *)title {
self.tabBar.translucent = NO;
[[UITabBar appearance] setBarTintColor:kClearColor];
[[UITabBar appearance] setTintColor:[UIColor clearColor]];
[UITabBar appearance].translucent = NO;
[UITabBar appearance].shadowImage = nil;
NSMutableDictionary *attrs = [NSMutableDictionary dictionary];
attrs[NSFontAttributeName] = [UIFont systemFontOfSize:11 weight:UIFontWeightMedium];
attrs[NSForegroundColorAttributeName] = HEXCOLORA(0x999999, 1);
NSMutableDictionary *attrSelected = [NSMutableDictionary dictionary];
attrSelected[NSFontAttributeName] = [UIFont systemFontOfSize:11 weight:UIFontWeightMedium];
attrSelected[NSForegroundColorAttributeName] = HEXCOLOR(0x333333);
UITabBarItem *item = [UITabBarItem appearance];
[item setTitleTextAttributes:attrs forState:UIControlStateNormal];
[item setTitleTextAttributes:attrSelected forState:UIControlStateSelected];
VC.title = title;
VC.tabBarItem.image = [image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
VC.tabBarItem.selectedImage = [selectedImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
MainNavigationController *NAV = [[MainNavigationController alloc] initWithRootViewController:VC];
[self addChildViewController:NAV];
if (@available(iOS 15.0, *)) {
UITabBarAppearance *appearance = [[UITabBarAppearance alloc] init];
//tabBaritem title
appearance.stackedLayoutAppearance.normal.titleTextAttributes = @{NSForegroundColorAttributeName:HEXCOLORA(0x999999, 1)};
//tabBaritem title
appearance.stackedLayoutAppearance.selected.titleTextAttributes = @{NSForegroundColorAttributeName:HEXCOLOR(0x333333)};
//tabBar
appearance.backgroundColor = kClearColor;
// appearance.backgroundImage = ImageNamed(@"tabbar_backIMG");
// appearance.backgroundImageContentMode = UIViewContentModeScaleToFill;
// self.tabBar.scrollEdgeAppearance = appearance;
// self.tabBar.standardAppearance = appearance;
}else{
self.tabBar.backgroundColor = UIColor.clearColor;
// [self.tabBar setBackgroundImage:[ImageNamed(@"tabbar_backIMG") imageWithRenderingMode:(UIImageRenderingModeAlwaysOriginal)]];
}
}
@end

View File

@@ -0,0 +1,18 @@
//
// SPCustomTabBar.h
// SweetParty
//
// Created by bj_szd on 2022/5/31.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface SPCustomTabBar : UITabBar
@property (nonatomic, strong) UIButton *centerBtn;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,64 @@
//
// SPCustomTabBar.m
// SweetParty
//
// Created by bj_szd on 2022/5/31.
//
#import "SPCustomTabBar.h"
@implementation SPCustomTabBar
#pragma mark - init method
- (instancetype)init
{
if (self = [super init]) {
// self.centerBtn = [UIButton buttonWithType:UIButtonTypeCustom];
// UIImage *normalImg = [UIImage imageNamed:@"tab_sweet"];
// [self.centerBtn setImage:normalImg forState:UIControlStateNormal];
// self.centerBtn.frame = CGRectMake((ScreenWidth-50)/2, -10, 50, 50);
// [self addSubview:self.centerBtn];
}
return self;
}
////线
- (void)layoutSubviews
{
[super layoutSubviews];
[self.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if ([obj isKindOfClass:NSClassFromString(@"_UIBarBackground")]) {
[obj.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj2, NSUInteger idx, BOOL * _Nonnull stop) {
//[array addObject:obj2];
if ([obj2 isKindOfClass:[UIVisualEffectView class]]) {
[obj2.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj3, NSUInteger idx, BOOL * _Nonnull stop) {
if ([obj3 isKindOfClass:NSClassFromString(@"_UIBarBackgroundShadowContentImageView")]) {
obj3.hidden = YES;
}
}];
}
}];
}
}];
}
#pragma mark - other
//
- (UIView*)hitTest:(CGPoint)point withEvent:(UIEvent *)event
{
UIView *view = [super hitTest:point withEvent:event];
if (self.isHidden==NO) {
if (view == nil){
//
CGPoint tempPoint = [self.centerBtn convertPoint:point fromView:self];
//
if (CGRectContainsPoint(self.centerBtn.bounds, tempPoint)){
//
return _centerBtn;
}
}
}
return view;
}
@end