Commit 229b1a8c by xuning

初始化项目

parent c333764b
...@@ -4,10 +4,10 @@ ...@@ -4,10 +4,10 @@
<dict> <dict>
<key>SchemeUserState</key> <key>SchemeUserState</key>
<dict> <dict>
<key>kfw_ios_fastservice.xcscheme_^#shared#^_</key> <key>fastservice.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>16</integer> <integer>17</integer>
</dict> </dict>
</dict> </dict>
</dict> </dict>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<Workspace <Workspace
version = "1.0"> version = "1.0">
<FileRef <FileRef
location = "group:FastService.xcodeproj"> location = "group:fastservice.xcodeproj">
</FileRef> </FileRef>
<FileRef <FileRef
location = "group:Pods/Pods.xcodeproj"> location = "group:Pods/Pods.xcodeproj">
......
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
uuid = "727AC540-CBF0-49A0-83FD-F6726944968E"
type = "0"
version = "2.0">
</Bucket>
// //
// AppDelegate.h // AppDelegate.h
// kfw_ios_fastservice // fastservice
// //
// Created by xuning on 1/31/24. // Created by xuning on 2/1/24.
// //
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate> @interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end @end
// //
// AppDelegate.m // AppDelegate.m
// kfw_ios_fastservice // fastservice
// //
// Created by xuning on 1/31/24. // Created by xuning on 2/1/24.
// //
#import "AppDelegate.h" #import "AppDelegate.h"
#import <AvoidCrash.h>
#import <IQKeyboardManager/IQKeyboardManager.h>
#import "XVLoginViewController.h"
@interface AppDelegate () @interface AppDelegate ()
@end @end
@implementation AppDelegate @implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
return YES;
}
[AvoidCrash makeAllEffective];
NSArray *noneSelClassStrings = @[
@"NSString"
];
[AvoidCrash setupNoneSelClassStringsArr:noneSelClassStrings];
// 设置主窗口,并设置根控制器
self.window = [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];
#pragma mark - UISceneSession lifecycle XVLoginViewController *vc = [[XVLoginViewController alloc]init];
self.window.rootViewController = vc;
self.window.backgroundColor = [UIColor redColor];
[self.window makeKeyAndVisible];
- (UISceneConfiguration *)application:(UIApplication *)application configurationForConnectingSceneSession:(UISceneSession *)connectingSceneSession options:(UISceneConnectionOptions *)options {
// Called when a new scene session is being created. [self setupIQKeyboard];
// Use this method to select a configuration to create the new scene with.
return [[UISceneConfiguration alloc] initWithName:@"Default Configuration" sessionRole:connectingSceneSession.role]; return YES;
} }
- (void)setupIQKeyboard {
// 禁用IQKeyboardManager的自动工具条
[IQKeyboardManager sharedManager].enableAutoToolbar = NO;
//键盘和上面的占位提示框之间又一点间距,会很难看
[[IQKeyboardManager sharedManager]setKeyboardDistanceFromTextField:0];
[IQKeyboardManager sharedManager].shouldResignOnTouchOutside = YES;
- (void)application:(UIApplication *)application didDiscardSceneSessions:(NSSet<UISceneSession *> *)sceneSessions {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
} }
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "fanhui@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "fanhui@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
<?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>
// //
// XVBaseViewController.h // XVBaseViewController.h
// kfw_ios_fastservice // fastservice
// //
// Created by xuning on 1/31/24. // Created by xuning on 2/2/24.
// Copyright © 2024 FastService. All rights reserved.
// //
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@interface XVBaseViewController : UIViewController @interface XVBaseViewController : UIViewController<UITableViewDelegate,UITableViewDataSource,DZNEmptyDataSetSource,DZNEmptyDataSetDelegate>
@property (nonatomic, strong) UITableView *tableView;
@end @end
......
// //
// XVBaseViewController.m // XVBaseViewController.m
// kfw_ios_fastservice // fastservice
// //
// Created by xuning on 1/31/24. // Created by xuning on 2/2/24.
// Copyright © 2024 FastService. All rights reserved.
// //
#import "XVBaseViewController.h" #import "XVBaseViewController.h"
@interface XVBaseViewController () @interface XVBaseViewController ()
@end @end
@implementation XVBaseViewController @implementation XVBaseViewController
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
// Do any additional setup after loading the view.
self.view.backgroundColor = DEFAULT_BACKGROUND_COLOR;
//ctrl + i 格式化
// 设置导航栏默认的背景颜色
[self wr_setNavBarBarTintColor:[UIColor whiteColor]];
// 设置导航栏标题默认颜色
[self wr_setNavBarTitleColor:[UIColor blackColor]];
[self wr_setStatusBarStyle:UIStatusBarStyleDefault];
// 如果需要设置导航栏底部分割线隐藏,可以在这里统一设置
[self wr_setNavBarShadowImageHidden:YES];
} }
/* - (UIImage *)imageForEmptyDataSet:(UIScrollView *)scrollView {
#pragma mark - Navigation return [UIImage imageNamed:@"nodata_图标"];
}
- (NSAttributedString *)titleForEmptyDataSet:(UIScrollView *)scrollView {
NSMutableAttributedString *text = [NSMutableAttributedString new];
UIFont *font = [UIFont systemFontOfSize:15];
[text appendAttributedString:[[NSAttributedString alloc] initWithString:@"暂无数据" attributes:@{NSFontAttributeName : font,NSForegroundColorAttributeName:kHexRGB(0xB49A9A)}]];
return text;
}
- (BOOL)emptyDataSetShouldAllowScroll:(UIScrollView *)scrollView {
return YES;
}
// In a storyboard-based application, you will often want to do a little preparation before navigation - (UITableView *)tableView {
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if (_tableView == nil) {
// Get the new view controller using [segue destinationViewController]. _tableView = [[UITableView alloc]initWithFrame:CGRectZero style:UITableViewStylePlain];
// Pass the selected object to the new view controller. _tableView.delegate = self;
_tableView.dataSource = self;
_tableView.emptyDataSetSource = self;
_tableView.emptyDataSetDelegate = self;
_tableView.tableFooterView = [UIView new];
_tableView.backgroundColor = DEFAULT_BACKGROUND_COLOR;
_tableView.rowHeight = UITableViewAutomaticDimension;
_tableView.estimatedRowHeight = 100;
}
return _tableView;
} }
*/
@end @end
// //
// XVBaseNavController.h // XVNaviViewController.h
// kfw_ios_fastservice // fastservice
// //
// Created by xuning on 1/31/24. // Created by xuning on 2/2/24.
// Copyright © 2024 FastService. All rights reserved. // Copyright © 2024 FastService. All rights reserved.
// //
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@interface XVBaseNavController : UINavigationController @interface XVNaviViewController : UINavigationController
@end @end
......
//
// XVNaviViewController.m
// fastservice
//
// Created by xuning on 2/2/24.
// Copyright © 2024 FastService. All rights reserved.
//
#import "XVNaviViewController.h"
@interface XVNaviViewController ()
@end
@implementation XVNaviViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.interactivePopGestureRecognizer.delegate=(id)self;
}
- (void)back {
// 判断两种情况: push 和 present
if ((self.presentedViewController || self.presentingViewController) && self.childViewControllers.count == 1) {
[self dismissViewControllerAnimated:YES completion:nil];
}else{
[self popViewControllerAnimated:YES];
}
}
#pragma mark - 非根控制器隐藏底部tabbar
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated{
if (self.viewControllers.count > 0) {
viewController.hidesBottomBarWhenPushed = YES;
viewController.navigationItem.leftBarButtonItem = [UIBarButtonItem itemWithTarget:self action:@selector(back) image:IMG(@"fanhui")];
}
[super pushViewController:viewController animated:animated];
//解决iPhone X Push 过程中 TabBar 位置上移
CGRect frame = self.tabBarController.tabBar.frame;
frame.origin.y = [UIScreen mainScreen].bounds.size.height - frame.size.height;
self.tabBarController.tabBar.frame = frame;
}
@end
//
// XVInputFieldView.h
// fastservice
//
// Created by xuning on 2/2/24.
// Copyright © 2024 FastService. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface XVInputFieldView : UIView
@end
NS_ASSUME_NONNULL_END
//
// XVInputFieldView.m
// fastservice
//
// Created by xuning on 2/2/24.
// Copyright © 2024 FastService. All rights reserved.
//
#import "XVInputFieldView.h"
@implementation XVInputFieldView
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
@end
//
// ImageCenterBtn.h
// ButtonTopImage
//
// Created by AliThink on 15/9/16.
// Copyright (c) 2015年 AliThink. All rights reserved.
//
// This code is distributed under the terms and conditions of the MIT license.
// Copyright (c) 2015 AliThink
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <UIKit/UIKit.h>
@interface ImageCenterButton : UIButton
// Round Image
@property BOOL imageIsRound;
// Image Padding
@property CGFloat padding;
// Spacing between imageview and textlabel
@property CGFloat imageTextSpace;
// Maximum imageview size
@property CGSize imageViewMaxSize;
// Button backgroundHighlighted
@property(nonatomic, strong) UIColor *backgroundHighlightedColor;
// Button backgroundNormal
@property(nonatomic, strong) UIColor *backgroundNormalColor;
@end
//
// ImageCenterBtn.m
// ButtonTopImage
//
// Created by AliThink on 15/9/16.
// Copyright (c) 2015年 AliThink. All rights reserved.
//
// This code is distributed under the terms and conditions of the MIT license.
// Copyright (c) 2015 AliThink
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "ImageCenterButton.h"
#define IMAGECENTERBUTTON_IMAGE_TEXT_SPACING 10.0
#define IMAGECENTERBUTTON_TITLE_MIN_HEIGHT 14.0
#define IMAGECENTERBUTTON_PADDING_MIN 8.0
@implementation ImageCenterButton
- (instancetype)initWithCoder:(NSCoder *)aDecoder {
self = [super initWithCoder:aDecoder];
if (self) {
[self addAction];
}
return self;
}
- (instancetype)init {
self = [super init];
if (self) {
[self addAction];
}
return self;
}
- (void)addAction {
[self addTarget:self action:@selector(pressed:) forControlEvents:UIControlEventTouchDown];
[self addTarget:self action:@selector(touchUp:) forControlEvents:UIControlEventTouchUpInside];
[self addTarget:self action:@selector(touchUp:) forControlEvents:UIControlEventTouchUpOutside];
}
- (void)layoutSubviews {
[super layoutSubviews];
self.adjustsImageWhenHighlighted = NO;
if (!self.padding) {
self.padding = IMAGECENTERBUTTON_PADDING_MIN;
}
if (!self.imageTextSpace) {
self.imageTextSpace = IMAGECENTERBUTTON_IMAGE_TEXT_SPACING;
}
CGFloat titleLabelHeight = self.titleLabel.frame.size.height;
if (titleLabelHeight == 0) {
titleLabelHeight = IMAGECENTERBUTTON_TITLE_MIN_HEIGHT;
}
CGFloat imageMaxHeight = self.frame.size.height - titleLabelHeight - self.imageTextSpace - self.padding * 2;
CGFloat imageMaxWidth = self.frame.size.width - self.padding * 2;
if (self.imageViewMaxSize.height) {
imageMaxHeight = self.imageViewMaxSize.height;
}
if (self.imageViewMaxSize.width) {
imageMaxWidth = self.imageViewMaxSize.width;
}
//Set ImageView Threshold
if (self.imageView.frame.size.height > imageMaxHeight) {
CGRect newImageView = self.imageView.frame;
newImageView.size = CGSizeMake(imageMaxHeight / self.imageView.frame.size.height * self.imageView.frame.size.width, imageMaxHeight);
self.imageView.frame = newImageView;
}
if (self.imageView.frame.size.width > imageMaxWidth) {
CGRect newImageView = self.imageView.frame;
newImageView.size = CGSizeMake(imageMaxWidth , imageMaxWidth / self.imageView.frame.size.width * self.imageView.frame.size.height);
self.imageView.frame = newImageView;
}
CGFloat totalHeight = self.imageView.frame.size.height + self.imageTextSpace + titleLabelHeight;
//Center image
CGPoint center = self.imageView.center;
center.x = self.frame.size.width / 2.0;
center.y = self.frame.size.height / 2.0 - totalHeight / 2.0 + self.imageView.frame.size.height / 2.0;
self.imageView.center = center;
if (self.imageIsRound) {
self.imageView.layer.cornerRadius = self.imageView.frame.size.width / 2.0;
}
CGRect titleLabelFrame = self.titleLabel.frame;
titleLabelFrame.size = CGSizeMake(self.frame.size.width, titleLabelHeight);
self.titleLabel.frame = titleLabelFrame;
//Center text
CGPoint titleCenter = self.titleLabel.center;
titleCenter.x = self.frame.size.width / 2.0;
titleCenter.y = self.imageView.center.y + self.imageView.frame.size.height / 2.0 + self.imageTextSpace + titleLabelHeight / 2.0;
self.titleLabel.center = titleCenter;
self.titleLabel.textAlignment = NSTextAlignmentCenter;
}
- (void)pressed:(UIButton *)btn {
if (self.backgroundHighlightedColor) {
[btn setBackgroundColor:self.backgroundHighlightedColor];
} else {
[btn setBackgroundColor:[UIColor colorWithRed:0.9 green:0.9 blue:0.9 alpha:1]];
}
}
- (void)touchUp:(UIButton *)btn {
if (self.backgroundNormalColor) {
[btn setBackgroundColor:self.backgroundNormalColor];
} else {
[btn setBackgroundColor:[UIColor whiteColor]];
}
}
@end
//
// NSObject+SXRuntime.h
// UINavigation-SXFixSpace
//
// Created by charles on 2017/9/8.
// Copyright © 2017年 None. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <objc/runtime.h>
@interface NSObject (SXRuntime)
/**
swizzle 类方法
@param oriSel 原有的方法
@param swiSel swizzle的方法
*/
+ (void)swizzleClassMethodWithOriginSel:(SEL)oriSel swizzledSel:(SEL)swiSel;
/**
swizzle 实例方法
@param oriSel 原有的方法
@param swiSel swizzle的方法
*/
+ (void)swizzleInstanceMethodWithOriginSel:(SEL)oriSel swizzledSel:(SEL)swiSel;
/**
判断方法是否在子类里override了
@param cls 传入要判断的Class
@param sel 传入要判断的Selector
@return 返回判断是否被重载的结果
*/
- (BOOL)isMethodOverride:(Class)cls selector:(SEL)sel;
/**
判断当前类是否在主bundle里
@param cls 出入类
@return 返回判断结果
*/
+ (BOOL)isMainBundleClass:(Class)cls;
/**
动态创建绑定selector的类
tip:每当无法找到selectorcrash转发过来的所有selector都会追加到当前Class上
@param aSelector 传入selector
@return 返回创建的类
*/
+ (Class)addMethodToStubClass:(SEL)aSelector;
@end
//
// NSObject+SXRuntime.m
// UINavigation-SXFixSpace
//
// Created by charles on 2017/9/8.
// Copyright © 2017年 None. All rights reserved.
//
#import "NSObject+SXRuntime.h"
char * const kProtectCrashProtectorName = "kProtectCrashProtector";
void ProtectCrashProtected(id self, SEL sel) {
}
@implementation NSObject (SXRuntime)
// MARK: Util
+ (void)swizzleClassMethodWithOriginSel:(SEL)oriSel swizzledSel:(SEL)swiSel {
Class cls = object_getClass(self);
Method originAddObserverMethod = class_getClassMethod(cls, oriSel);
Method swizzledAddObserverMethod = class_getClassMethod(cls, swiSel);
[self swizzleMethodWithOriginSel:oriSel oriMethod:originAddObserverMethod swizzledSel:swiSel swizzledMethod:swizzledAddObserverMethod class:cls];
}
+ (void)swizzleInstanceMethodWithOriginSel:(SEL)oriSel swizzledSel:(SEL)swiSel {
Method originAddObserverMethod = class_getInstanceMethod(self, oriSel);
Method swizzledAddObserverMethod = class_getInstanceMethod(self, swiSel);
[self swizzleMethodWithOriginSel:oriSel oriMethod:originAddObserverMethod swizzledSel:swiSel swizzledMethod:swizzledAddObserverMethod class:self];
}
+ (void)swizzleMethodWithOriginSel:(SEL)oriSel
oriMethod:(Method)oriMethod
swizzledSel:(SEL)swizzledSel
swizzledMethod:(Method)swizzledMethod
class:(Class)cls {
BOOL didAddMethod = class_addMethod(cls, oriSel, method_getImplementation(swizzledMethod), method_getTypeEncoding(swizzledMethod));
if (didAddMethod) {
class_replaceMethod(cls, swizzledSel, method_getImplementation(oriMethod), method_getTypeEncoding(oriMethod));
} else {
method_exchangeImplementations(oriMethod, swizzledMethod);
}
}
+ (Class)addMethodToStubClass:(SEL)aSelector {
Class ProtectCrashProtector = objc_getClass(kProtectCrashProtectorName);
if (!ProtectCrashProtector) {
ProtectCrashProtector = objc_allocateClassPair([NSObject class], kProtectCrashProtectorName, sizeof([NSObject class]));
objc_registerClassPair(ProtectCrashProtector);
}
class_addMethod(ProtectCrashProtector, aSelector, (IMP)ProtectCrashProtected, "v@:");
return ProtectCrashProtector;
}
- (BOOL)isMethodOverride:(Class)cls selector:(SEL)sel {
IMP clsIMP = class_getMethodImplementation(cls, sel);
IMP superClsIMP = class_getMethodImplementation([cls superclass], sel);
return clsIMP != superClsIMP;
}
+ (BOOL)isMainBundleClass:(Class)cls {
return cls && [[NSBundle bundleForClass:cls] isEqual:[NSBundle mainBundle]];
}
@end;
//
// UIBarButtonItem+SXCreate.h
// UINavigation-SXFixSpace
//
// Created by charles on 2017/9/8.
// Copyright © 2017年 None. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIBarButtonItem (SXCreate)
/**
根据图片生成UIBarButtonItem
@param target target对象
@param action 响应方法
@param image image
@return 生成的UIBarButtonItem
*/
+(UIBarButtonItem *)itemWithTarget:(id)target action:(SEL)action image:(UIImage *)image;
/**
根据图片生成UIBarButtonItem
@param target target对象
@param action 响应方法
@param image image
@param imageEdgeInsets 图片偏移
@return 生成的UIBarButtonItem
*/
+(UIBarButtonItem *)itemWithTarget:(id)target action:(SEL)action image:(UIImage *)image imageEdgeInsets:(UIEdgeInsets)imageEdgeInsets;
/**
根据图片生成UIBarButtonItem
@param target target对象
@param action 响应方法
@param nomalImage nomalImage
@param higeLightedImage higeLightedImage
@param imageEdgeInsets 图片偏移
@return 生成的UIBarButtonItem
*/
+(UIBarButtonItem *)itemWithTarget:(id)target
action:(SEL)action
nomalImage:(UIImage *)nomalImage
higeLightedImage:(UIImage *)higeLightedImage
imageEdgeInsets:(UIEdgeInsets)imageEdgeInsets;
/**
根据文字生成UIBarButtonItem
@param target target对象
@param action 响应方法
@param title title
*/
+(UIBarButtonItem *)itemWithTarget:(id)target action:(SEL)action title:(NSString *)title;
+(UIBarButtonItem *)itemWithTarget:(id)target action:(SEL)action title:(NSString *)title titleColor:(UIColor *)titleColor;
/**
根据文字生成UIBarButtonItem
@param target target对象
@param action 响应方法
@param title title
@param titleEdgeInsets 文字偏移
@return 生成的UIBarButtonItem
*/
+(UIBarButtonItem *)itemWithTarget:(id)target action:(SEL)action title:(NSString *)title titleEdgeInsets:(UIEdgeInsets)titleEdgeInsets;
/**
根据文字生成UIBarButtonItem
@param target target对象
@param action 响应方法
@param title title
@param font font
@param titleColor 字体颜色
@param highlightedColor 高亮颜色
@param titleEdgeInsets 文字偏移
@return 生成的UIBarButtonItem
*/
+(UIBarButtonItem *)itemWithTarget:(id)target
action:(SEL)action
title:(NSString *)title
font:(UIFont *)font
titleColor:(UIColor *)titleColor
highlightedColor:(UIColor *)highlightedColor
titleEdgeInsets:(UIEdgeInsets)titleEdgeInsets;
/**
用作修正位置的UIBarButtonItem
@param width 修正宽度
@return 修正位置的UIBarButtonItem
*/
+(UIBarButtonItem *)fixedSpaceWithWidth:(CGFloat)width;
@end
//
// UIBarButtonItem+SXCreate.m
// UINavigation-SXFixSpace
//
// Created by charles on 2017/9/8.
// Copyright © 2017年 None. All rights reserved.
//
#import "UIBarButtonItem+SXCreate.h"
@implementation UIBarButtonItem (SXCreate)
+(UIBarButtonItem *)itemWithTarget:(id)target action:(SEL)action image:(UIImage *)image {
return [self itemWithTarget:target action:action nomalImage:image higeLightedImage:nil imageEdgeInsets:UIEdgeInsetsZero];
}
+(UIBarButtonItem *)itemWithTarget:(id)target action:(SEL)action image:(UIImage *)image imageEdgeInsets:(UIEdgeInsets)imageEdgeInsets {
return [self itemWithTarget:target action:action nomalImage:image higeLightedImage:nil imageEdgeInsets:imageEdgeInsets];
}
+(UIBarButtonItem *)itemWithTarget:(id)target
action:(SEL)action
nomalImage:(UIImage *)nomalImage
higeLightedImage:(UIImage *)higeLightedImage
imageEdgeInsets:(UIEdgeInsets)imageEdgeInsets {
UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
[button addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
[button setImage:[nomalImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal];
if (higeLightedImage) {
[button setImage:higeLightedImage forState:UIControlStateHighlighted];
}
[button sizeToFit];
if (button.bounds.size.width < 40) {
CGFloat width = 40 / button.bounds.size.height * button.bounds.size.width;
button.bounds = CGRectMake(0, 0, width, 40);
}
if (button.bounds.size.height > 40) {
CGFloat height = 40 / button.bounds.size.width * button.bounds.size.height;
button.bounds = CGRectMake(0, 0, 40, height);
}
button.imageEdgeInsets = imageEdgeInsets;
return [[UIBarButtonItem alloc] initWithCustomView:button];
}
+(UIBarButtonItem *)itemWithTarget:(id)target action:(SEL)action title:(NSString *)title {
return [self itemWithTarget:target action:action title:title font:nil titleColor:[UIColor whiteColor] highlightedColor:nil titleEdgeInsets:UIEdgeInsetsZero];
}
+(UIBarButtonItem *)itemWithTarget:(id)target action:(SEL)action title:(NSString *)title titleColor:(UIColor *)titleColor {
return [self itemWithTarget:target action:action title:title font:[UIFont systemFontOfSize:14] titleColor:titleColor highlightedColor:titleColor titleEdgeInsets:UIEdgeInsetsZero];
}
+(UIBarButtonItem *)itemWithTarget:(id)target action:(SEL)action title:(NSString *)title titleEdgeInsets:(UIEdgeInsets)titleEdgeInsets {
return [self itemWithTarget:target action:action title:title font:nil titleColor:nil highlightedColor:nil titleEdgeInsets:titleEdgeInsets];
}
+(UIBarButtonItem *)itemWithTarget:(id)target
action:(SEL)action
title:(NSString *)title
font:(UIFont *)font
titleColor:(UIColor *)titleColor
highlightedColor:(UIColor *)highlightedColor
titleEdgeInsets:(UIEdgeInsets)titleEdgeInsets {
UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
[button addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
[button setTitle:title forState:UIControlStateNormal];
button.titleLabel.font = font?font:nil;
[button setTitleColor:titleColor?titleColor:[UIColor blackColor] forState:UIControlStateNormal];
[button setTitleColor:highlightedColor?highlightedColor:nil forState:UIControlStateHighlighted];
[button sizeToFit];
if (button.bounds.size.width < 40) {
CGFloat width = 40 / button.bounds.size.height * button.bounds.size.width;
button.bounds = CGRectMake(0, 0, width, 40);
}
if (button.bounds.size.height > 40) {
CGFloat height = 40 / button.bounds.size.width * button.bounds.size.height;
button.bounds = CGRectMake(0, 0, 40, height);
}
button.titleEdgeInsets = titleEdgeInsets;
return [[UIBarButtonItem alloc] initWithCustomView:button];
}
+(UIBarButtonItem *)fixedSpaceWithWidth:(CGFloat)width {
UIBarButtonItem *fixedSpace = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
fixedSpace.width = width;
return fixedSpace;
}
@end
//
// UINavigation+SXFixSpace.h
// UINavigation-SXFixSpace
//
// Created by charles on 2017/9/8.
// Copyright © 2017年 None. All rights reserved.
//
#import <UIKit/UIKit.h>
#ifndef sx_defaultFixSpace
#define sx_defaultFixSpace 8
#endif
@interface UINavigationController (SXFixSpace)
@end
@interface UINavigationBar (SXFixSpace)
@end
@interface UINavigationItem (SXFixSpace)
@end
//
// UINavigation+SXFixSpace.m
// UINavigation-SXFixSpace
//
// Created by charles on 2017/9/8.
// Copyright © 2017年 None. All rights reserved.
//
#import "UINavigation+SXFixSpace.h"
#import "NSObject+SXRuntime.h"
#import <UIKit/UIKit.h>
#import <Availability.h>
#ifndef deviceVersion
#define deviceVersion [[[UIDevice currentDevice] systemVersion] floatValue]
#endif
static BOOL sx_disableFixSpace = NO;
static BOOL sx_tempDisableFixSpace = NO;
@implementation UINavigationController (SXFixSpace)
+(void)load {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
[self swizzleInstanceMethodWithOriginSel:@selector(viewWillAppear:)
swizzledSel:@selector(sx_viewWillAppear:)];
[self swizzleInstanceMethodWithOriginSel:@selector(viewWillDisappear:)
swizzledSel:@selector(sx_viewWillDisappear:)];
//FIXME:修正iOS11之后push或者pop动画为NO 系统不主动调用UINavigationBar的layoutSubviews方法
if (deviceVersion >= 11) {
[self swizzleInstanceMethodWithOriginSel:@selector(pushViewController:animated:)
swizzledSel:@selector(sx_pushViewController:animated:)];
[self swizzleInstanceMethodWithOriginSel:@selector(popViewControllerAnimated:)
swizzledSel:@selector(sx_popViewControllerAnimated:)];
[self swizzleInstanceMethodWithOriginSel:@selector(popToViewController:animated:)
swizzledSel:@selector(sx_popToViewController:animated:)];
[self swizzleInstanceMethodWithOriginSel:@selector(popToRootViewControllerAnimated:)
swizzledSel:@selector(sx_popToRootViewControllerAnimated:)];
[self swizzleInstanceMethodWithOriginSel:@selector(setViewControllers:animated:)
swizzledSel:@selector(sx_setViewControllers:animated:)];
}
});
}
-(void)sx_viewWillAppear:(BOOL)animated {
if ([self isKindOfClass:[UIImagePickerController class]]) {
sx_tempDisableFixSpace = sx_disableFixSpace;
sx_disableFixSpace = YES;
}
[self sx_viewWillAppear:animated];
}
-(void)sx_viewWillDisappear:(BOOL)animated{
if ([self isKindOfClass:[UIImagePickerController class]]) {
sx_disableFixSpace = sx_tempDisableFixSpace;
}
[self sx_viewWillDisappear:animated];
}
//FIXME:修正iOS11之后push或者pop动画为NO 系统不主动调用UINavigationBar的layoutSubviews方法
-(void)sx_pushViewController:(UIViewController *)viewController animated:(BOOL)animated {
[self sx_pushViewController:viewController animated:animated];
if (!animated) {
[self.navigationBar layoutSubviews];
}
}
- (nullable UIViewController *)sx_popViewControllerAnimated:(BOOL)animated{
UIViewController *vc = [self sx_popViewControllerAnimated:animated];
if (!animated) {
[self.navigationBar layoutSubviews];
}
return vc;
}
- (nullable NSArray<__kindof UIViewController *> *)sx_popToViewController:(UIViewController *)viewController animated:(BOOL)animated{
NSArray *vcs = [self sx_popToViewController:viewController animated:animated];
if (!animated) {
[self.navigationBar layoutSubviews];
}
return vcs;
}
- (nullable NSArray<__kindof UIViewController *> *)sx_popToRootViewControllerAnimated:(BOOL)animated{
NSArray *vcs = [self sx_popToRootViewControllerAnimated:animated];
if (!animated) {
[self.navigationBar layoutSubviews];
}
return vcs;
}
- (void)sx_setViewControllers:(NSArray<UIViewController *> *)viewControllers animated:(BOOL)animated NS_AVAILABLE_IOS(3_0){
[self sx_setViewControllers:viewControllers animated:animated];
if (!animated) {
[self.navigationBar layoutSubviews];
}
}
@end
@implementation UINavigationBar (SXFixSpace)
+(void)load {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
[self swizzleInstanceMethodWithOriginSel:@selector(layoutSubviews)
swizzledSel:@selector(sx_layoutSubviews)];
});
}
-(void)sx_layoutSubviews{
[self sx_layoutSubviews];
if (deviceVersion >= 11 && !sx_disableFixSpace) {//需要调节
self.layoutMargins = UIEdgeInsetsZero;
CGFloat space = sx_defaultFixSpace;
for (UIView *subview in self.subviews) {
if ([NSStringFromClass(subview.class) containsString:@"ContentView"]) {
if (@available(iOS 13.0, *)) {
UIEdgeInsets margins = subview.layoutMargins;
subview.frame = CGRectMake(-margins.left, -margins.top, margins.left + margins.right + subview.frame.size.width, margins.top + margins.bottom + subview.frame.size.height);
} else {
subview.layoutMargins = UIEdgeInsetsMake(0, space, 0, space);//可修正iOS11之后的偏移
}
break;
}
}
}
}
@end
@implementation UINavigationItem (SXFixSpace)
+(void)load {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
[self swizzleInstanceMethodWithOriginSel:@selector(setLeftBarButtonItem:)
swizzledSel:@selector(sx_setLeftBarButtonItem:)];
[self swizzleInstanceMethodWithOriginSel:@selector(setLeftBarButtonItems:)
swizzledSel:@selector(sx_setLeftBarButtonItems:)];
[self swizzleInstanceMethodWithOriginSel:@selector(setRightBarButtonItem:)
swizzledSel:@selector(sx_setRightBarButtonItem:)];
[self swizzleInstanceMethodWithOriginSel:@selector(setRightBarButtonItems:)
swizzledSel:@selector(sx_setRightBarButtonItems:)];
});
}
-(void)sx_setLeftBarButtonItem:(UIBarButtonItem *)leftBarButtonItem {
if (deviceVersion >= 11) {
[self sx_setLeftBarButtonItem:leftBarButtonItem];
} else {
if (!sx_disableFixSpace && leftBarButtonItem) {//存在按钮且需要调节
[self setLeftBarButtonItems:@[leftBarButtonItem]];
} else {//不存在按钮,或者不需要调节
[self sx_setLeftBarButtonItem:leftBarButtonItem];
}
}
}
-(void)sx_setLeftBarButtonItems:(NSArray<UIBarButtonItem *> *)leftBarButtonItems {
if (leftBarButtonItems.count) {
NSMutableArray *items = [NSMutableArray arrayWithObject:[self fixedSpaceWithWidth:sx_defaultFixSpace-20]];//可修正iOS11之前的偏移
[items addObjectsFromArray:leftBarButtonItems];
[self sx_setLeftBarButtonItems:items];
} else {
[self sx_setLeftBarButtonItems:leftBarButtonItems];
}
}
-(void)sx_setRightBarButtonItem:(UIBarButtonItem *)rightBarButtonItem{
if (deviceVersion >= 11) {
[self sx_setRightBarButtonItem:rightBarButtonItem];
} else {
if (!sx_disableFixSpace && rightBarButtonItem) {//存在按钮且需要调节
[self setRightBarButtonItems:@[rightBarButtonItem]];
} else {//不存在按钮,或者不需要调节
[self sx_setRightBarButtonItem:rightBarButtonItem];
}
}
}
-(void)sx_setRightBarButtonItems:(NSArray<UIBarButtonItem *> *)rightBarButtonItems{
if (rightBarButtonItems.count) {
NSMutableArray *items = [NSMutableArray arrayWithObject:[self fixedSpaceWithWidth:sx_defaultFixSpace-20]];//可修正iOS11之前的偏移
[items addObjectsFromArray:rightBarButtonItems];
[self sx_setRightBarButtonItems:items];
} else {
[self sx_setRightBarButtonItems:rightBarButtonItems];
}
}
-(UIBarButtonItem *)fixedSpaceWithWidth:(CGFloat)width {
UIBarButtonItem *fixedSpace = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace
target:nil
action:nil];
fixedSpace.width = width;
return fixedSpace;
}
@end
...@@ -17,9 +17,11 @@ ...@@ -17,9 +17,11 @@
// 判断当前设备类型是否为 iPhone // 判断当前设备类型是否为 iPhone
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) { if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
// 获取屏幕的高度 // 获取屏幕的高度
// CGFloat screenHeight = [[UIScreen mainScreen] bounds].size.height; CGFloat screenHeight = [[UIScreen mainScreen] bounds].size.height;
CGFloat screenWidth = [[UIScreen mainScreen] bounds].size.width;
// 目前已知的两个异形屏尺寸:375x812、414x896 // 目前已知的两个异形屏尺寸:375x812、414x896
if (IS_IPHONE_SPECIAL) { CGFloat ratio = screenHeight/screenWidth;
if (ratio < 0.5 || ratio > 2.0) {
return YES; return YES;
} }
} }
......
...@@ -2,24 +2,12 @@ ...@@ -2,24 +2,12 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>UIApplicationSceneManifest</key> <key>NSAppTransportSecurity</key>
<dict> <dict>
<key>UIApplicationSupportsMultipleScenes</key> <key>NSAllowsArbitraryLoads</key>
<false/> <true/>
<key>UISceneConfigurations</key>
<dict>
<key>UIWindowSceneSessionRoleApplication</key>
<array>
<dict>
<key>UISceneConfigurationName</key>
<string>Default Configuration</string>
<key>UISceneDelegateClassName</key>
<string>SceneDelegate</string>
<key>UISceneStoryboardFile</key>
<string>Main</string>
</dict>
</array>
</dict>
</dict> </dict>
<key>UIFileSharingEnabled</key>
<true/>
</dict> </dict>
</plist> </plist>
//
// XVLoginViewController.h
// fastservice
//
// Created by xuning on 2/2/24.
// Copyright © 2024 FastService. All rights reserved.
//
#import "XVBaseViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface XVLoginViewController : XVBaseViewController
@end
NS_ASSUME_NONNULL_END
// //
// XVBaseNavController.m // XVLoginViewController.m
// kfw_ios_fastservice // fastservice
// //
// Created by xuning on 1/31/24. // Created by xuning on 2/2/24.
// Copyright © 2024 FastService. All rights reserved. // Copyright © 2024 FastService. All rights reserved.
// //
#import "XVBaseNavController.h" #import "XVLoginViewController.h"
@interface XVBaseNavController () @interface XVLoginViewController ()
@end @end
@implementation XVBaseNavController @implementation XVLoginViewController
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
// Do any additional setup after loading the view.
self.view.backgroundColor = COLOR_THEMEGRENN;
} }
/* /*
......
//
// PrefixHeader.pch
// fastservice
//
// Created by xuning on 2/1/24.
//
#ifndef PrefixHeader_pch
#define PrefixHeader_pch
#ifdef __OBJC__
#import <YYKit.h>
#import "MJExtension.h"
#import "UIImageView+WebCache.h"
#import <UIScrollView+EmptyDataSet.h>
#import <MBProgressHUD.h>
#import <Masonry.h>
#import <MJRefresh/MJRefresh.h>
#import "WRNavigationBar.h"
#import <LEEAlert.h>
#import "UINavigationController+FDFullscreenPopGesture.h"
#import "UINavigation+SXFixSpace.h"
#import "UIBarButtonItem+SXCreate.h"
#endif
#ifdef DEBUG
#define Log(FORMAT, ...) fprintf(stderr,"[%s:%d行] %s\n",[[[NSString stringWithUTF8String:__FILE__] lastPathComponent] UTF8String], __LINE__, [[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] UTF8String]);
#else
#define Log(...)
#endif
#define IMG(imageName) [UIImage imageNamed:[NSString stringWithFormat:@"%@",imageName]]
#define RGBAColor(r,g,b,a) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:a]
#define kHexRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
#define kRandomColor KRGB(arc4random_uniform(256), arc4random_uniform(256), arc4random_uniform(256))
#define COLOR_THEMEGRENN [UIColor colorWithHexString:@"#4EB97B"]
#define DEFAULT_BACKGROUND_COLOR kHexRGB(0xf8f8f8)
#define kViewBorderRadius(View, Radius, Width, Color)\
[View.layer setCornerRadius:(Radius)];\
[View.layer setMasksToBounds:YES];\
[View.layer setBorderWidth:(Width)];\
[View.layer setBorderColor:[Color CGColor]];
#define widthScale ([UIScreen mainScreen].bounds.size.width/375.0f)
#define SCREEN_HEIGHT [[UIScreen mainScreen] bounds].size.height
#define SCREEN_WIDTH [[UIScreen mainScreen] bounds].size.width
//状态栏高度
#define KSTATUSBAR_HEIGHT [[UIApplication sharedApplication] statusBarFrame].size.height
//导航条高度
#define KNAVBAR_HEIGHT 44.0
//底部tabbar高度
#define KTABBAR_HEIGHT ([[UIApplication sharedApplication] statusBarFrame].size.height>20?83:49)
//整个顶部的高度
#define KTOP_HEIGHT (KSTATUSBAR_HEIGHT + KNAVBAR_HEIGHT)
#define IS_IPHONEX ({\
BOOL isPhoneX = NO;\
if (@available(iOS 11.0, *)) {\
if ([[[UIApplication sharedApplication] delegate] window].safeAreaInsets.bottom > 0.0) {\
isPhoneX = YES;\
}\
}\
isPhoneX;\
})
//iphoneX适配差值
#define KiPhoneXSafeAreaDValue ([[UIApplication sharedApplication] statusBarFrame].size.height>20?34:0)
#define kObjectIsEmpty(_object) (_object == nil \
|| [_object isKindOfClass:[NSNull class]] \
|| ([_object respondsToSelector:@selector(length)] && [(NSData *)_object length] == 0) \
|| ([_object respondsToSelector:@selector(count)] && [(NSArray *)_object count] == 0))
// 字符串是否为空
#define kStringIsEmpty(str) ([str isKindOfClass:[NSNull class]] || str == nil || [str length] < 1 ? YES : NO )
// 数组是否为空
#define kArrayIsEmpty(array) (array == nil || [array isKindOfClass:[NSNull class]] || array.count == 0)
#define WS(weakSelf) __weak __typeof(&*self)weakSelf = self;
#endif /* PrefixHeader_pch */
//
// SceneDelegate.h
// kfw_ios_fastservice
//
// Created by xuning on 1/31/24.
//
#import <UIKit/UIKit.h>
@interface SceneDelegate : UIResponder <UIWindowSceneDelegate>
@property (strong, nonatomic) UIWindow * window;
@end
//
// SceneDelegate.m
// kfw_ios_fastservice
//
// Created by xuning on 1/31/24.
//
#import "SceneDelegate.h"
@interface SceneDelegate ()
@end
@implementation SceneDelegate
- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
}
- (void)sceneDidDisconnect:(UIScene *)scene {
// Called as the scene is being released by the system.
// This occurs shortly after the scene enters the background, or when its session is discarded.
// Release any resources associated with this scene that can be re-created the next time the scene connects.
// The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead).
}
- (void)sceneDidBecomeActive:(UIScene *)scene {
// Called when the scene has moved from an inactive state to an active state.
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
}
- (void)sceneWillResignActive:(UIScene *)scene {
// Called when the scene will move from an active state to an inactive state.
// This may occur due to temporary interruptions (ex. an incoming phone call).
}
- (void)sceneWillEnterForeground:(UIScene *)scene {
// Called as the scene transitions from the background to the foreground.
// Use this method to undo the changes made on entering the background.
}
- (void)sceneDidEnterBackground:(UIScene *)scene {
// Called as the scene transitions from the foreground to the background.
// Use this method to save data, release shared resources, and store enough scene-specific state information
// to restore the scene back to its current state.
}
@end
// //
// main.m // main.m
// kfw_ios_fastservice // fastservice
// //
// Created by xuning on 1/31/24. // Created by xuning on 2/1/24.
// //
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
......
//
// kfw_ios_fastserviceTests.m
// kfw_ios_fastserviceTests
//
// Created by xuning on 1/31/24.
//
#import <XCTest/XCTest.h>
@interface kfw_ios_fastserviceTests : XCTestCase
@end
@implementation kfw_ios_fastserviceTests
- (void)setUp {
// Put setup code here. This method is called before the invocation of each test method in the class.
}
- (void)tearDown {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
- (void)testExample {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
- (void)testPerformanceExample {
// This is an example of a performance test case.
[self measureBlock:^{
// Put the code you want to measure the time of here.
}];
}
@end
//
// kfw_ios_fastserviceUITests.m
// kfw_ios_fastserviceUITests
//
// Created by xuning on 1/31/24.
//
#import <XCTest/XCTest.h>
@interface kfw_ios_fastserviceUITests : XCTestCase
@end
@implementation kfw_ios_fastserviceUITests
- (void)setUp {
// Put setup code here. This method is called before the invocation of each test method in the class.
// In UI tests it is usually best to stop immediately when a failure occurs.
self.continueAfterFailure = NO;
// In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
}
- (void)tearDown {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
- (void)testExample {
// UI tests must launch the application that they test.
XCUIApplication *app = [[XCUIApplication alloc] init];
[app launch];
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
- (void)testLaunchPerformance {
if (@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 7.0, *)) {
// This measures how long it takes to launch your application.
[self measureWithMetrics:@[[[XCTApplicationLaunchMetric alloc] init]] block:^{
[[[XCUIApplication alloc] init] launch];
}];
}
}
@end
//
// kfw_ios_fastserviceUITestsLaunchTests.m
// kfw_ios_fastserviceUITests
//
// Created by xuning on 1/31/24.
//
#import <XCTest/XCTest.h>
@interface kfw_ios_fastserviceUITestsLaunchTests : XCTestCase
@end
@implementation kfw_ios_fastserviceUITestsLaunchTests
+ (BOOL)runsForEachTargetApplicationUIConfiguration {
return YES;
}
- (void)setUp {
self.continueAfterFailure = NO;
}
- (void)testLaunch {
XCUIApplication *app = [[XCUIApplication alloc] init];
[app launch];
// Insert steps here to perform after app launch but before taking a screenshot,
// such as logging into a test account or navigating somewhere in the app
XCTAttachment *attachment = [XCTAttachment attachmentWithScreenshot:XCUIScreen.mainScreen.screenshot];
attachment.name = @"Launch Screen";
attachment.lifetime = XCTAttachmentLifetimeKeepAlways;
[self addAttachment:attachment];
}
@end
# Uncomment the next line to define a global platform for your project # Uncomment the next line to define a global platform for your project
platform :ios, '9.0' platform :ios, '9.0'
source 'https://github.com/CocoaPods/Specs.git' source 'https://github.com/CocoaPods/Specs.git'
target 'fastservice' do
target 'kfw_ios_fastservice' do
# Comment the next line if you don't want to use dynamic frameworks # Comment the next line if you don't want to use dynamic frameworks
use_frameworks! use_frameworks!
# Pods for fastservice
pod 'AFNetworking' pod 'AFNetworking'
pod 'Masonry' pod 'Masonry'
pod 'MJRefresh' pod 'MJRefresh'
...@@ -17,9 +18,9 @@ target 'kfw_ios_fastservice' do ...@@ -17,9 +18,9 @@ target 'kfw_ios_fastservice' do
pod 'LEEAlert' pod 'LEEAlert'
pod 'AvoidCrash' pod 'AvoidCrash'
pod 'DZNEmptyDataSet' pod 'DZNEmptyDataSet'
pod 'IQKeyboardManager'
pod 'BRPickerView' pod 'BRPickerView'
pod "UINavigation-SXFixSpace"
pod 'Bugly' pod 'Bugly'
pod 'BMKLocationKit' pod 'BMKLocationKit'
...@@ -32,13 +33,4 @@ target 'kfw_ios_fastservice' do ...@@ -32,13 +33,4 @@ target 'kfw_ios_fastservice' do
# pod 'BaiduNaviKit-All/Cloud', '6.0.0' # 集成地图Cloud包 # pod 'BaiduNaviKit-All/Cloud', '6.0.0' # 集成地图Cloud包
pod 'BaiduNaviKit-All/Utils', '6.4.0' # 集成地图Utils包 pod 'BaiduNaviKit-All/Utils', '6.4.0' # 集成地图Utils包
target 'kfw_ios_fastserviceTests' do
inherit! :search_paths
# Pods for testing
end
target 'kfw_ios_fastserviceUITests' do
# Pods for testing
end
end end
...@@ -41,6 +41,7 @@ PODS: ...@@ -41,6 +41,7 @@ PODS:
- BRPickerView/Base - BRPickerView/Base
- Bugly (2.5.93) - Bugly (2.5.93)
- DZNEmptyDataSet (1.8.1) - DZNEmptyDataSet (1.8.1)
- IQKeyboardManager (6.5.11)
- LEEAlert (1.6.4) - LEEAlert (1.6.4)
- Masonry (1.1.0) - Masonry (1.1.0)
- MBProgressHUD (1.2.0) - MBProgressHUD (1.2.0)
...@@ -50,7 +51,6 @@ PODS: ...@@ -50,7 +51,6 @@ PODS:
- SDWebImage (5.15.2): - SDWebImage (5.15.2):
- SDWebImage/Core (= 5.15.2) - SDWebImage/Core (= 5.15.2)
- SDWebImage/Core (5.15.2) - SDWebImage/Core (5.15.2)
- UINavigation-SXFixSpace (1.2.4)
- YYKit (1.0.9): - YYKit (1.0.9):
- YYKit/no-arc (= 1.0.9) - YYKit/no-arc (= 1.0.9)
- YYKit/no-arc (1.0.9) - YYKit/no-arc (1.0.9)
...@@ -67,6 +67,7 @@ DEPENDENCIES: ...@@ -67,6 +67,7 @@ DEPENDENCIES:
- BRPickerView - BRPickerView
- Bugly - Bugly
- DZNEmptyDataSet - DZNEmptyDataSet
- IQKeyboardManager
- LEEAlert - LEEAlert
- Masonry - Masonry
- MBProgressHUD - MBProgressHUD
...@@ -74,7 +75,6 @@ DEPENDENCIES: ...@@ -74,7 +75,6 @@ DEPENDENCIES:
- MJRefresh - MJRefresh
- SAMKeychain - SAMKeychain
- SDWebImage - SDWebImage
- UINavigation-SXFixSpace
- YYKit - YYKit
SPEC REPOS: SPEC REPOS:
...@@ -86,6 +86,7 @@ SPEC REPOS: ...@@ -86,6 +86,7 @@ SPEC REPOS:
- BRPickerView - BRPickerView
- Bugly - Bugly
- DZNEmptyDataSet - DZNEmptyDataSet
- IQKeyboardManager
- LEEAlert - LEEAlert
- Masonry - Masonry
- MBProgressHUD - MBProgressHUD
...@@ -93,7 +94,6 @@ SPEC REPOS: ...@@ -93,7 +94,6 @@ SPEC REPOS:
- MJRefresh - MJRefresh
- SAMKeychain - SAMKeychain
- SDWebImage - SDWebImage
- UINavigation-SXFixSpace
- YYKit - YYKit
SPEC CHECKSUMS: SPEC CHECKSUMS:
...@@ -104,6 +104,7 @@ SPEC CHECKSUMS: ...@@ -104,6 +104,7 @@ SPEC CHECKSUMS:
BRPickerView: a0ff460bf092bc069db5a54153395b1f7e8f5300 BRPickerView: a0ff460bf092bc069db5a54153395b1f7e8f5300
Bugly: b8715e6ec4004b7f7fbffab0643ba80545aee3da Bugly: b8715e6ec4004b7f7fbffab0643ba80545aee3da
DZNEmptyDataSet: 9525833b9e68ac21c30253e1d3d7076cc828eaa7 DZNEmptyDataSet: 9525833b9e68ac21c30253e1d3d7076cc828eaa7
IQKeyboardManager: ef43ce1ba1e5aaf4adf222c0a46f39761f246879
LEEAlert: a604ad481e3e9b021421a271f78594926dd034bb LEEAlert: a604ad481e3e9b021421a271f78594926dd034bb
Masonry: 678fab65091a9290e40e2832a55e7ab731aad201 Masonry: 678fab65091a9290e40e2832a55e7ab731aad201
MBProgressHUD: 3ee5efcc380f6a79a7cc9b363dd669c5e1ae7406 MBProgressHUD: 3ee5efcc380f6a79a7cc9b363dd669c5e1ae7406
...@@ -111,9 +112,8 @@ SPEC CHECKSUMS: ...@@ -111,9 +112,8 @@ SPEC CHECKSUMS:
MJRefresh: fdf5e979eb406a0341468932d1dfc8b7f9fce961 MJRefresh: fdf5e979eb406a0341468932d1dfc8b7f9fce961
SAMKeychain: 483e1c9f32984d50ca961e26818a534283b4cd5c SAMKeychain: 483e1c9f32984d50ca961e26818a534283b4cd5c
SDWebImage: 8ab87d4b3e5cc4927bd47f78db6ceb0b94442577 SDWebImage: 8ab87d4b3e5cc4927bd47f78db6ceb0b94442577
UINavigation-SXFixSpace: 10f223253ebff2ceefa26694e23b7694269763c4
YYKit: 7cda43304a8dc3696c449041e2cb3107b4e236e7 YYKit: 7cda43304a8dc3696c449041e2cb3107b4e236e7
PODFILE CHECKSUM: 707a9f75067f2737529bdb707d00e5248f0dc1e2 PODFILE CHECKSUM: 83e1bf4ab5642ba08ff9082d3b51ce8b146e2aa1
COCOAPODS: 1.11.3 COCOAPODS: 1.11.3
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment