Initial commit

This commit is contained in:
lianxiang
2018-08-22 11:15:52 +08:00
parent d98e20881f
commit 249bf6864e
491 changed files with 68665 additions and 7 deletions
+13
View File
@@ -0,0 +1,13 @@
//
// AppDelegate+Config.h
// GIGA
//
// Created by lianxiang on 2018/8/13.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import "AppDelegate.h"
@interface AppDelegate ()
@end
+20
View File
@@ -0,0 +1,20 @@
//
// AppDelegate+GiGaConfig.h
// GIGA
//
// Created by lianxiang on 2018/8/13.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import "AppDelegate.h"
@interface AppDelegate (GiGaConfig)
- (void)setupTabBarController;
- (void)configEnvironment;
//v1.0
- (void)setupRootVC;
@end
+90
View File
@@ -0,0 +1,90 @@
//
// AppDelegate+GiGaConfig.m
// GIGA
//
#import "AppDelegate+GiGaConfig.h"
#import "GiGaServerConfig.h"
#import "GiGaUserViewController.h"
#import "GiGaExercisesViewController.h"
#import "GiGaBaseNavViewController.h"
#import "GiGaMaskTaskViewController.h"
#import "GiGaUserDefault.h"
@implementation AppDelegate (GiGaConfig)
-(void)setupTabBarController{
GiGaExercisesViewController *exerciseVC = [[GiGaExercisesViewController alloc] init];
GiGaBaseNavViewController *exerciseNav =[[GiGaBaseNavViewController alloc] initWithRootViewController:exerciseVC];
exerciseNav.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName : [UIColor blackColor]};
exerciseNav.title = @"测试";
exerciseNav.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"测试"
image:nil
selectedImage:nil];
GiGaMaskTaskViewController *maskVC = [[GiGaMaskTaskViewController alloc] init];
GiGaBaseNavViewController *maskNav =[[GiGaBaseNavViewController alloc] initWithRootViewController:maskVC];
maskNav.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName : [UIColor blackColor]};
maskNav.title = @"测试2";
maskNav.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"测试2"
image:nil
selectedImage:nil];
GiGaUserViewController *userVC = [[GiGaUserViewController alloc] init];
GiGaBaseNavViewController *userNav = [[GiGaBaseNavViewController alloc] initWithRootViewController:userVC];
userNav.navigationBar.titleTextAttributes =@{NSForegroundColorAttributeName:[UIColor blackColor]};
userNav.title = @"我的";
userNav.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"我的" image:nil selectedImage:nil];
[[UITabBar appearance] setTintColor:GIGARGB(70, 70, 70, 1)];
self.rootTabBarVC = [[UITabBarController alloc] init];
self.rootTabBarVC.viewControllers = @[exerciseNav,maskNav,userNav];
[self initTabItems];
self.window.rootViewController = self.rootTabBarVC;
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
}
-(void)initTabItems{
UITabBar *tabBar = self.rootTabBarVC.tabBar;
UITabBarItem *item0 = [tabBar.items objectAtIndex:0];
UITabBarItem *item1 = [tabBar.items objectAtIndex:1];
UITabBarItem *item2 = [tabBar.items objectAtIndex:2];
item0.selectedImage = [[UIImage imageNamed:@""] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
;
item0.image = [[UIImage imageNamed:@""] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
item1.selectedImage = [[UIImage imageNamed:@""] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
;
item1.image = [[UIImage imageNamed:@""] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
item2.selectedImage = [[UIImage imageNamed:@""] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
;
item2.image = [[UIImage imageNamed:@""] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
}
-(void)configEnvironment{
[GiGaServerConfig setServerType:GIGA_ENVIRONMENT];
}
//
- (void)setupRootVC{
GiGaMaskTaskViewController *maskeVC = [[GiGaMaskTaskViewController alloc] init];
GiGaBaseNavViewController *maskNav =[[GiGaBaseNavViewController alloc] initWithRootViewController:maskeVC];
maskNav.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName : [UIColor blackColor]};
maskeVC.title = @"面膜时间";
self.window.rootViewController = maskNav;
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
}
@end
+23
View File
@@ -0,0 +1,23 @@
//
// AppDelegate+ThirdParty.h
// GIGA
//
// Created by lianxiang on 2018/8/16.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import "AppDelegate.h"
#import "WXApi.h"
#import "JPUSHService.h"
// iOS10注册APNs所需头文件
#ifdef NSFoundationVersionNumber_iOS_9_x_Max
#import <UserNotifications/UserNotifications.h>
#endif
@interface AppDelegate (ThirdParty)<JPUSHRegisterDelegate,WXApiDelegate>
-(void)configThridPartyWithOptions:(NSDictionary *)launchOptions;
@end
+109
View File
@@ -0,0 +1,109 @@
//
// AppDelegate+ThirdParty.m
// GIGA
//
// Created by lianxiang on 2018/8/16.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import "AppDelegate+ThirdParty.h"
#define PUSH_APPKEY @"1f8122badd24c2adb8b3f231"
@implementation AppDelegate (ThirdParty)
-(void)configThridPartyWithOptions:(NSDictionary *)launchOptions{
//极光推送
//APNS Regist
JPUSHRegisterEntity * entity = [[JPUSHRegisterEntity alloc] init];
entity.types = JPAuthorizationOptionAlert|JPAuthorizationOptionBadge|JPAuthorizationOptionSound;
if ([[UIDevice currentDevice].systemVersion floatValue] >= 8.0) {
// 可以添加自定义categories
// NSSet<UNNotificationCategory *> *categories for iOS10 or later
// NSSet<UIUserNotificationCategory *> *categories for iOS8 and iOS9
}
[JPUSHService registerForRemoteNotificationConfig:entity delegate:self];
// Required
// init Push
[JPUSHService setupWithOption:launchOptions appKey:PUSH_APPKEY
channel:@"App store"
apsForProduction:GIGA_PUSH_ENVIRONMENT
advertisingIdentifier:nil];
//微信
}
// 微信
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
{
return [WXApi handleOpenURL:url delegate:self];
}
//WXApiDelegate
- (void)onReq:(BaseReq *)req{
}
- (void)onResp:(BaseResp *)resp{
NSLog(@"resp:%d",resp.errCode);
if ([resp isKindOfClass:[SendAuthResp class]]) {
SendAuthResp*rep = (SendAuthResp*)resp;
if (resp.errCode == 0) {
[[NSNotificationCenter defaultCenter] postNotificationName: @"WXAuthSuccess" object:@{@"code":rep.code}];
}
}
}
// ios 10 Support
- (void)jpushNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler API_AVAILABLE(ios(10.0)){
// Required
NSDictionary * userInfo = response.notification.request.content.userInfo;
if([response.notification.request.trigger isKindOfClass:[UNPushNotificationTrigger class]]) {
[JPUSHService handleRemoteNotification:userInfo];
}
completionHandler(); // 系统要求执行这个方法
}
- (void)jpushNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(NSInteger))completionHandler API_AVAILABLE(ios(10.0)){
// Required
NSDictionary * userInfo = notification.request.content.userInfo;
if([notification.request.trigger isKindOfClass:[UNPushNotificationTrigger class]]) {
[JPUSHService handleRemoteNotification:userInfo];
}
completionHandler(UNNotificationPresentationOptionAlert); // 需要执行这个方法,选择是否提醒用户,有Badge、Sound、Alert三种类型可以选择设置
}
-(void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{
[JPUSHService registerDeviceToken:deviceToken];
}
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {
//Optional
NSLog(@"did Fail To Register For Remote Notifications With Error: %@", error);
}
//ios8 以下本应用可忽略
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
// Required, iOS 7 Support
[JPUSHService handleRemoteNotification:userInfo];
completionHandler(UIBackgroundFetchResultNewData);
}
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
// Required,For systems with less than or equal to iOS6
[JPUSHService handleRemoteNotification:userInfo];
}
@end
+1
View File
@@ -11,6 +11,7 @@
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@property (nonatomic ,strong) UITabBarController *rootTabBarVC;
@end
+12 -1
View File
@@ -7,6 +7,9 @@
//
#import "AppDelegate.h"
#import "AppDelegate+GiGaConfig.h"
#import "AppDelegate+ThirdParty.h"
#import "GiGaUserDefault.h"
@interface AppDelegate ()
@@ -17,10 +20,18 @@
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
[NSThread sleepForTimeInterval:1];//延迟启动
[self configThridPartyWithOptions:launchOptions];
[self configEnvironment];
[self setupRootVC];
//[self setupTabBarController];
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
@@ -0,0 +1,13 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "maske_dismiss_waring.png",
"scale" : "1x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 306 B

+17
View File
@@ -0,0 +1,17 @@
//
// GiGaBlockButton.h
// GIGA
//
// Created by lianxiang on 2018/8/20.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import <UIKit/UIKit.h>
typedef void (^ClickActionBlock)(UIButton *);
@interface GiGaBlockButton : UIButton
@property(nonatomic,copy) ClickActionBlock clickBlock;
-(void)initWithBlock:(ClickActionBlock)clickBlock for:(UIControlEvents)envent;
@end
+20
View File
@@ -0,0 +1,20 @@
//
// GiGaBlockButton.m
// GIGA
//
// Created by lianxiang on 2018/8/20.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import "GiGaBlockButton.h"
@implementation GiGaBlockButton
-(void)initWithBlock:(ClickActionBlock)clickBlock for:(UIControlEvents)envent{
[self addTarget:self action:@selector(btnAction:) forControlEvents:envent];
self.clickBlock = clickBlock;
}
-(void)btnAction:(UIButton *)btn{
self.clickBlock(btn);
}
@end
+20
View File
@@ -0,0 +1,20 @@
//
// UINavigationBar+Custom.h
// GIGA
//
// Created by lianxiang on 2018/8/13.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UINavigationBar (Custom)
- (void)cnSetBackgroundColor:(UIColor *)backgroundColor;
- (void)cnReset;
//设置透明导航
-(void)setClearNav;
-(void)resetBackgroundImage;
@end
+65
View File
@@ -0,0 +1,65 @@
//
// UINavigationBar+Custom.m
// GIGA
//
// Created by lianxiang on 2018/8/13.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import <objc/runtime.h>
#import "UINavigationBar+Custom.h"
static char overlayKey;
@implementation UINavigationBar (Custom)
- (UIView *)overlay
{
return objc_getAssociatedObject(self, &overlayKey);
}
- (void)setOverlay:(UIView *)overlay
{
objc_setAssociatedObject(self, &overlayKey, overlay, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
- (void)cnSetBackgroundColor:(UIColor *)backgroundColor
{
if (!self.overlay) {
[self setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
self.overlay = [[UIView alloc] initWithFrame:CGRectMake(0, -20, [UIScreen mainScreen].bounds.size.width, CGRectGetHeight(self.bounds) + 20)];
self.overlay.userInteractionEnabled = NO;
self.overlay.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
[self insertSubview:self.overlay atIndex:0];
}
self.overlay.backgroundColor = backgroundColor;
}
- (void)cnReset
{
[self setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
[self.overlay removeFromSuperview];
self.overlay = nil;
}
-(void)setClearNav
{
[self setBackgroundImage:[[UIImage alloc] init] forBarMetrics:UIBarMetricsDefault];
//设置那条横线直接隐藏
self.shadowImage = [[UIImage alloc] init];
if (self.overlay) {
[self.overlay removeFromSuperview];
self.overlay = nil;
}
}
-(void)resetBackgroundImage{
[self setBackgroundImage:[UIImage imageNamed:@""] forBarMetrics:UIBarMetricsDefault];
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent animated:NO];
}
@end
+87
View File
@@ -0,0 +1,87 @@
//
// Copyright 2009-2010 Facebook
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
@interface UIView (Sizes)
/**
* Shortcut for frame.origin.x.
*
* Sets frame.origin.x = left
*/
@property (nonatomic) CGFloat left;
/**
* Shortcut for frame.origin.y
*
* Sets frame.origin.y = top
*/
@property (nonatomic) CGFloat top;
/**
* Shortcut for frame.origin.x + frame.size.width
*
* Sets frame.origin.x = right - frame.size.width
*/
@property (nonatomic) CGFloat right;
/**
* Shortcut for frame.origin.y + frame.size.height
*
* Sets frame.origin.y = bottom - frame.size.height
*/
@property (nonatomic) CGFloat bottom;
/**
* Shortcut for frame.size.width
*
* Sets frame.size.width = width
*/
@property (nonatomic) CGFloat width;
/**
* Shortcut for frame.size.height
*
* Sets frame.size.height = height
*/
@property (nonatomic) CGFloat height;
/**
* Shortcut for center.x
*
* Sets center.x = centerX
*/
@property (nonatomic) CGFloat centerX;
/**
* Shortcut for center.y
*
* Sets center.y = centerY
*/
@property (nonatomic) CGFloat centerY;
/**
* Shortcut for frame.origin
*/
@property (nonatomic) CGPoint origin;
/**
* Shortcut for frame.size
*/
@property (nonatomic) CGSize size;
@end
+118
View File
@@ -0,0 +1,118 @@
//
// Copyright 2009-2010 Facebook
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#import "UIView+Sizes.h"
@implementation UIView (Sizes)
- (CGFloat)left {
return self.frame.origin.x;
}
- (void)setLeft:(CGFloat)x {
CGRect frame = self.frame;
frame.origin.x = floorf(x);
self.frame = frame;
}
- (CGFloat)top {
return self.frame.origin.y;
}
- (void)setTop:(CGFloat)y {
CGRect frame = self.frame;
frame.origin.y = floorf(y);
self.frame = frame;
}
- (CGFloat)right {
return self.frame.origin.x + self.frame.size.width;
}
- (void)setRight:(CGFloat)right {
CGRect frame = self.frame;
frame.origin.x = floorf(right - frame.size.width);
self.frame = frame;
}
- (CGFloat)bottom {
return self.frame.origin.y + self.frame.size.height;
}
- (void)setBottom:(CGFloat)bottom {
CGRect frame = self.frame;
frame.origin.y = floorf(bottom - frame.size.height);
self.frame = frame;
}
- (CGFloat)centerX {
return self.center.x;
}
- (void)setCenterX:(CGFloat)centerX {
self.center = CGPointMake(floorf(centerX), floorf(self.center.y));
}
- (CGFloat)centerY {
return self.center.y;
}
- (void)setCenterY:(CGFloat)centerY {
self.center = CGPointMake(floorf(self.center.x), floorf(centerY));
}
- (CGFloat)width {
return self.frame.size.width;
}
- (void)setWidth:(CGFloat)width {
CGRect frame = self.frame;
frame.size.width = floorf(width);
self.frame = frame;
}
- (CGFloat)height {
return self.frame.size.height;
}
- (void)setHeight:(CGFloat)height {
CGRect frame = self.frame;
frame.size.height = floorf(height);
self.frame = frame;
}
- (CGPoint)origin {
return self.frame.origin;
}
- (void)setOrigin:(CGPoint)origin {
CGRect frame = self.frame;
frame.origin = origin;
self.frame = frame;
}
- (CGSize)size {
return self.frame.size;
}
- (void)setSize:(CGSize)size {
CGRect frame = self.frame;
frame.size = CGSizeMake(floorf(size.width), floorf(size.height));
self.frame = frame;
}
@end
@@ -0,0 +1,13 @@
//
// GiGaBaseNavViewController.h
// GIGA
//
// Created by lianxiang on 2018/8/13.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface GiGaBaseNavViewController : UINavigationController
@end
@@ -0,0 +1,68 @@
//
// GiGaBaseNavViewController.m
// GIGA
//
// Created by lianxiang on 2018/8/13.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import "GiGaBaseNavViewController.h"
@interface GiGaBaseNavViewController ()<UINavigationControllerDelegate>
@end
@implementation GiGaBaseNavViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
self.interactivePopGestureRecognizer.delegate = (id)self;
self.view.backgroundColor = UIColor.whiteColor;
}
-(UIStatusBarStyle)preferredStatusBarStyle
{
return UIStatusBarStyleDefault;
}
-(void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
{
if (self.viewControllers.count > 0) {
viewController.hidesBottomBarWhenPushed = YES;
}
[super pushViewController:viewController animated:animated];
if (self.viewControllers.count > 1 ) {
//自定义返回按钮
UIButton *backBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[backBtn setImage:[UIImage imageNamed:@""] forState:UIControlStateNormal];
backBtn.backgroundColor = [UIColor redColor];
[backBtn addTarget:self action:@selector(backItemAction) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithCustomView:backBtn];
viewController.navigationItem.leftBarButtonItem = backItem;
}
}
-(void)backItemAction{
[super popViewControllerAnimated:YES];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
@@ -0,0 +1,29 @@
//
// GiGaBaseViewController.h
// GIGA
//
// Created by lianxiang on 2018/8/13.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface GiGaBaseViewController : UIViewController<UIGestureRecognizerDelegate,UINavigationControllerDelegate>
{
UIView *emptyView;
}
//- (void)setNavigationViewWithBGColor:(UIColor *)bgColor TitleColor:(UIColor *)titleColor;
//- (void)setNavigationViewHidden:(BOOL)hidden;
//- (void)addBackButtonWithImageName:(NSString *)imageName;
//- (void)setBackButtonHidden:(BOOL)hidden;
//- (void)setNavigationViewBottomLineHidden:(BOOL)hidden;
//
//- (void)addRightButtonWithBGImageName:(NSString *)rightImageName action:(SEL)rightAction;
//
//- (void)addRefreshHeaderFooterForTableView:(UITableView *)tableView
// refreshHeaderSelector:(SEL)refreshHeaderSelector
// refreshFooterSelector:(SEL)refreshFooterSelector;
@end
@@ -0,0 +1,44 @@
//
// GiGaBaseViewController.m
// GIGA
//
// Created by lianxiang on 2018/8/13.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import "GiGaBaseViewController.h"
@interface GiGaBaseViewController ()
{
// UIColor *navigationBarBGColor; //导航栏背景色
// UIColor *navigationBarTitleColor; //导航栏标题字色
// SEL _rightBtnAction;
// SEL _refreshHeaderSelector;
// SEL _refreshFooterSelector;
}
@end
@implementation GiGaBaseViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
+41
View File
@@ -0,0 +1,41 @@
//
// GiGaHelper.h
// GIGA
//
// Created by lianxiang on 2018/8/13.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface GiGaHelper : NSObject
/**
* 获取当前时间 格式 yyyy-MM-dd hh:mm:ss
*/
+(NSString *) getNowTimeString;
/**
* 时间转时间戳
*/
+(long) timeStampWithDate:(NSDate *) timeDate;
/**
* 时间戳转时间
*/
+ (NSString *) dateWithTimeStamp:(long) longValue;
/**
* 根据时间间隔获取未来时间戳
hour 几小时
min 几分钟
second 几秒
*/
+(long)getFutureTimetstamp:(NSUInteger)hour minute:(NSUInteger)min second:(NSUInteger)second;
/**
* NSTimeInterval 转分钟秒
*/
+(NSString *)stringWithNSTimerinterval:(NSTimeInterval)interval;
@end
+72
View File
@@ -0,0 +1,72 @@
//
// GiGaHelper.m
// GIGA
//
// Created by lianxiang on 2018/8/13.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import "GiGaHelper.h"
@implementation GiGaHelper
+(NSString *) getNowTimeString{
NSDate *now = [NSDate date];
NSDateFormatter *formatDate = [[NSDateFormatter alloc] init];
formatDate.dateFormat= @"yyyy-MM-dd hh:mm:ss";
NSString *dayStr = [formatDate stringFromDate:now];
return dayStr;
}
+(long) timeStampWithDate:(NSDate *) timeDate{
long timeStamp = 0;
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"YYYY-MM-dd HH:mm:ss"];
NSString *timeString = [formatter stringFromDate:timeDate];
NSDate *date = [formatter dateFromString:timeString];
timeStamp = (long)[date timeIntervalSince1970];
return timeStamp;
}
+ (NSString *) dateWithTimeStamp:(long) longValue{
long value = longValue;
NSDateFormatter *formatDay = [[NSDateFormatter alloc] init];
formatDay.dateFormat = @"yyyy-MM-dd hh:mm:ss";
NSNumber *time = [NSNumber numberWithLong:value];
//转换成NSTimeInterval
NSTimeInterval nsTimeInterval = [time longValue];
NSDate *date = [[NSDate alloc] initWithTimeIntervalSince1970:nsTimeInterval];
NSString *dayStr = [formatDay stringFromDate:date];
return dayStr;
}
+(long)getFutureTimetstamp:(NSUInteger)hour minute:(NSUInteger)min second:(NSUInteger)second{
NSDate *datenow = [NSDate date];
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"YYYY年MM月dd日HH:mm:ss"];
NSTimeInterval timeInterval = hour * 3600 + min * 60 + second;
NSDate *futrueDate = [datenow dateByAddingTimeInterval:timeInterval];
NSString *futrueTimeStr = [formatter stringFromDate:futrueDate];
NSDate *furtureformatDate = [formatter dateFromString:futrueTimeStr];
long futrueTimestamp= [furtureformatDate timeIntervalSince1970];
return futrueTimestamp;
}
+(NSString *)stringWithNSTimerinterval:(NSTimeInterval)interval{
NSInteger min = interval / 60;
NSInteger sec = (NSInteger) interval % 60;
return [NSString stringWithFormat:@"%02ld:%02ld",min,sec];
}
@end
+71
View File
@@ -0,0 +1,71 @@
//
// GiGaAPIRequest.h
// GIGA
//
// Created by lianxiang on 2018/8/15.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "GiGaAPIResult.h"
@class GiGaAPIRequest;
#define DEFALUT_APIREQUEST_TIMEOUT 20
typedef enum GiGaRequestType {
kRequestTypeGet,
kRequestTypePost,
kRequestTypeUpload,
kRequestTypeMultiUpload
}GiGaRequestTyp;
typedef enum ApiResultFormat {
kApiResultJson,
kApiResultXml,
}ApiResultFormat;
@protocol GiGaApiRquestDelegate<NSObject>
@optional
- (void)serverApiFinishedSuccessed:(GiGaAPIRequest *)api result:(GiGaAPIResult *)result;
- (void)serverApiRequestFailed:(GiGaAPIRequest *)api error:(NSError *)error;
- (void)serverApiFinishedFailed:(GiGaAPIRequest *)api result:(GiGaAPIResult *)result;
@end
@interface GiGaAPIRequest : NSObject
#pragma mark - porperty
/** 请求类型 */
@property (nonatomic, readonly) GiGaRequestTyp requestType;
/** 请求返回的格式 */
@property (nonatomic, readonly) ApiResultFormat resultFormat;
/** 请求超时时间 */
@property (nonatomic, readonly) NSTimeInterval timeout;
/** 服务器地址 */
@property (nonatomic, readonly) NSString *serviceUrl;
/** 请求路径 */
@property (nonatomic, readonly) NSString *fullUrl;
/** 代理 */
@property (nonatomic, weak) id<GiGaApiRquestDelegate> delegate;
/** 请求参数数组 */
@property (nonatomic, strong) NSMutableArray *params;
#pragma mark - Method
- (id)initWithDelegate:(id<GiGaApiRquestDelegate>)delegate;
/**
* 拼接公共参数
*/
- (void)appendBaseParams;
#pragma mark - APIRequestDelegate
/**
* 返回数据调用方法
*/
- (void)callBackFinishedWithDictionary:(NSDictionary *)dic;
/**
* 返回数据错误
*/
- (void)callBackFailed:(NSError *)error;
@end
+81
View File
@@ -0,0 +1,81 @@
//
// GiGaAPIRequest.m
// GIGA
//
// Created by lianxiang on 2018/8/15.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import "GiGaAPIRequest.h"
#import "GiGaServerConfig.h"
@implementation GiGaAPIRequest
- (id)initWithDelegate:(id<GiGaApiRquestDelegate>)delegate
{
if (self = [super init]) {
self.params = [NSMutableArray array];
self.delegate = delegate;
}
return self;
}
//默认Get访问
- (GiGaRequestTyp)requestType
{
return kRequestTypeGet;
}
//默认超时时间
- (NSTimeInterval)timeout
{
return DEFALUT_APIREQUEST_TIMEOUT;
}
//服务器地址
-(NSString *)serviceUrl{
return [GiGaServerConfig getMainUrl];
}
/** 拼接的请求地址 */
//
- (NSString *)fullUrl
{
// 服务器地址 和 接口名
NSString *url = [NSString stringWithFormat:@"%@",self.serviceUrl];
return url;
}
// 数据请求完成的 回调
- (void)callBackFinishedWithDictionary:(NSDictionary *)dic
{
// 处理 responseObject
GiGaAPIResult *resu = [[GiGaAPIResult alloc] initWithDictionary:dic];
// error ID = 0
if (resu.success) {
if (self.delegate && [self.delegate respondsToSelector:@selector(serverApiFinishedSuccessed: result:)]) {
//
[self.delegate serverApiFinishedSuccessed:self result:resu];
}
// error ID = 1
} else {
if (self.delegate && [self.delegate respondsToSelector:@selector(serverApiFinishedFailed:result:)]) {
[self.delegate serverApiFinishedFailed:self result:resu];
}
}
}
// 数据请求失败的回调
- (void)callBackFailed:(NSError *)error
{
if (self.delegate && [self.delegate respondsToSelector:@selector(serverApiRequestFailed:error:)]) {
[self.delegate serverApiRequestFailed:self error:error];
}
}
// 拼接的基本参数
- (void)appendBaseParams
{
}
@end
+24
View File
@@ -0,0 +1,24 @@
//
// GiGaAPIResult.h
// GIGA
//
// Created by lianxiang on 2018/8/15.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface GiGaAPIResult : NSObject
/** 提示信息 */
@property (nonatomic, copy) NSString *message;
/** 请求状态 */
@property (nonatomic, assign) NSInteger status;
/** 请求是否成功 */
@property (nonatomic, readonly) BOOL success;
/** 接收数据的字典 */
@property (nonatomic, strong) NSDictionary *dic;
- (id)initWithDictionary:(NSDictionary *)dic;
@end
+49
View File
@@ -0,0 +1,49 @@
//
// GiGaAPIResult.m
// GIGA
//
// Created by lianxiang on 2018/8/15.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import "GiGaAPIResult.h"
@implementation GiGaAPIResult
-(BOOL)success{
return self.status == 0;
}
-(id)initWithDictionary:(NSDictionary *)dic
{
if (self = [super init]) {
@try {
if (dic && ![dic isKindOfClass:[NSNull class]]) {
self.status = [[dic objectForKey:@"errorcode"] intValue];//待定
self.message = [dic objectForKey:@""];//待定
NSDictionary *data = [[dic objectForKey:@"result"] objectForKey:@"data"];
self.dic = data;
}else{
self.message = @"网络错误";
self.dic = nil;
self.status = 1;
}
}
@catch(NSException *exception) {
self.dic = dic;
self.status = 0;
}
@finally {
}
}
return self;
}
@end
+15
View File
@@ -0,0 +1,15 @@
//
// GiGaNetManager.h
// GIGA
//
// Created by lianxiang on 2018/8/15.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "GiGaAPIRequest.h"
@interface GiGaNetManager : NSObject
+(GiGaNetManager *)shareInstance;
+(void)request:(GiGaAPIRequest*)api;
@end
+70
View File
@@ -0,0 +1,70 @@
//
// GiGaNetManager.m
// GIGA
//
// Created by lianxiang on 2018/8/15.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import "GiGaNetManager.h"
#import "AFNetworking.h"
#import "GiGaServerConfig.h"
@interface GiGaNetManager()
@end
@implementation GiGaNetManager
+ (GiGaNetManager *)shareInstance{
static GiGaNetManager *instance = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
instance = [[self alloc] init];
});
return instance;
}
+ (void)request:(GiGaAPIRequest *)api{
NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
NSURL *baseUrl = [NSURL URLWithString:[GiGaServerConfig getMainUrl]];
AFHTTPSessionManager*manager=[[AFHTTPSessionManager alloc] initWithBaseURL:baseUrl sessionConfiguration:configuration];
manager.responseSerializer=[AFHTTPResponseSerializer serializer];
switch (api.requestType) {
case kRequestTypeGet:
{
[manager GET:api.fullUrl parameters:api.params progress:^(NSProgress * _Nonnull downloadProgress) {
} success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
NSDictionary *outDic = (NSDictionary *)responseObject;
[api callBackFinishedWithDictionary:outDic];
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
[api callBackFailed:error];
}];
}
break;
case kRequestTypePost:
{
[manager POST:api.fullUrl parameters:api.params progress:^(NSProgress * _Nonnull uploadProgress) {
} success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
NSDictionary *outDic = (NSDictionary *)responseObject;
[api callBackFinishedWithDictionary:outDic];
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
[api callBackFailed:error];
}];
}
break;
default:
break;
}
}
@end
+42
View File
@@ -0,0 +1,42 @@
//
// GiGaUserDefault.h
// GIGA
//
// Created by lianxiang on 2018/8/15.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface GiGaUserDefault : NSObject
+(void)saveUserId:(NSString *)userId;
+(NSString *)getCurentUserId;
+(void)removeUserId;
+(BOOL)isUserLogin;
/**
保存用户表版本号
*/
+(void)saveDBVersion:(NSInteger)versionNum;
+(NSInteger)getOldVersion;
/**
新手页(蒙版)
@param showedGaurd 是否展示过 default NO
*/
+(void)saveUsergaurdflag:(BOOL)showedGaurd;
+(BOOL)isShowedGaurd;
/**
App 引导页
@param showedGaurd 是否展示过 default NO
*/
+(void)saveAppGaurdflag:(BOOL)showedGaurd;
+(BOOL)isShowedAppGaurd;
@end
+79
View File
@@ -0,0 +1,79 @@
//
// GiGaUserDefault.m
// GIGA
//
// Created by lianxiang on 2018/8/15.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import "GiGaUserDefault.h"
NSString *const kUserManagerVerision = @"GiGAUserDBVeriosn";
NSString *const GIGADEFAULTKEY_USERID = @"GiGaUserId";
NSString *const kShowUserGuard = @"ShowUserGuard";
NSString *const kShowAppGuard = @"ShowAppGuard";
@implementation GiGaUserDefault
+(void)saveUserId:(NSString *)userId{
UD_SET_KEY_VALUE(GIGADEFAULTKEY_USERID, userId);
}
+(NSString*)getCurentUserId{
NSString *userid = UD_GET_VALUE(GIGADEFAULTKEY_USERID);
return userid;
}
+(void)removeUserId{
UD_REMOVE_KEY(GIGADEFAULTKEY_USERID);
}
+(BOOL)isUserLogin{
NSString *uid = UD_GET_VALUE(GIGADEFAULTKEY_USERID);
return uid ? YES : NO;
}
+(void)saveDBVersion:(NSInteger)versionNum{
NSNumber *verNum = [NSNumber numberWithInteger:versionNum];
UD_SET_KEY_VALUE(verNum.stringValue, kUserManagerVerision);
}
+ (NSInteger)getOldVersion{
return (NSInteger)UD_GET_VALUE(kUserManagerVerision);
}
+(void)saveUsergaurdflag:(BOOL)showedGaurd
{
[UD_STADARDUD setBool:showedGaurd forKey:kShowUserGuard];
[UD_STADARDUD synchronize];
}
+(BOOL)isShowedGaurd
{
BOOL showedGaurd = [UD_STADARDUD boolForKey:kShowUserGuard];
return showedGaurd;
}
+(void)saveAppGaurdflag:(BOOL)showedGaurd;
{
[UD_STADARDUD setBool:showedGaurd forKey:kShowAppGuard];
[UD_STADARDUD synchronize];
}
+(BOOL)isShowedAppGaurd{
BOOL showedGaurd = [UD_STADARDUD boolForKey:kShowAppGuard];
return showedGaurd;
}
@end
+25
View File
@@ -0,0 +1,25 @@
//
// GiGaUserManager.h
// GIGA
//
// Created by lianxiang on 2018/8/15.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "GiGaUser.h"
@interface GiGaUserManager : NSObject
@property(nonatomic,strong) GiGaUser *user;
+(instancetype)shareUser;
- (void)saveUser:(GiGaUser *)user;
- (GiGaUser*)getCurrentUser;
-(void)loginOut;
/**
版本升级检测
*/
//-(void)detectionUserUpgrade;
@end
+108
View File
@@ -0,0 +1,108 @@
//
// GiGaUserManager.m
// GIGA
//
// Created by lianxiang on 2018/8/15.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import "GiGaUserManager.h"
#import "YTKKeyValueStore.h"
#import "GiGaUserDefault.h"
NSString *const GIGA_USER_TABLE = @"user_table";
const static NSInteger GIGADB_USER_VER = 0;//当前数据库版本号
@interface GiGaUserManager()
@property (nonatomic,strong) YTKKeyValueStore *store;
@property (nonatomic,strong) NSMutableArray *userArr;
@property (nonatomic,copy) NSString *userTabId;
@end
@implementation GiGaUserManager
+ (instancetype)shareUser{
static GiGaUserManager *userManager = nil;
static dispatch_once_t once;
dispatch_once(&once, ^{
userManager = [[self alloc] init];
});
return userManager;
}
-(instancetype)init{
self = [super init];
if (self) {
// 打开名为GiGa.db的数据库,如果该文件不存在,则创新一个新的。
self.store = [[YTKKeyValueStore alloc] initDBWithName:@"GiGa.db"];
[self creatTableByName:GIGA_USER_TABLE];
_userArr = [NSMutableArray new];
[self detectionUserUpgrade];
}
return self;
}
//建表
-(void)creatTableByName:(NSString *)tableName{
[_store createTableWithName:tableName];
}
- (void)saveUser:(GiGaUser *)user{
self.user = user;
NSString *userTableId = [NSString stringWithFormat:@"%@",user.userId];
self.userTabId = userTableId;
//暂定只保留一个用户
[_userArr removeAllObjects];
[_userArr addObject:user];
[_store putObject:_userArr withId:userTableId intoTable:GIGA_USER_TABLE];
[GiGaUserDefault saveUserId:userTableId];
}
//已登录
-(GiGaUser *)getCurrentUser{
NSString *useriD = [GiGaUserDefault getCurentUserId];
NSArray *usrA= [_store getObjectById:useriD fromTable:GIGA_USER_TABLE];
if (usrA && usrA.count > 0) {
self.user = usrA[0];
}
return self.user;
}
//
-(void)loginOut{
self.user = nil;
[GiGaUserDefault removeUserId];
}
- (void)detectionUserUpgrade{
NSInteger oldVerion = [GiGaUserDefault getOldVersion];
if (GIGADB_USER_VER <= oldVerion) {
return;
}
[self upgradUserDBToNew];
[GiGaUserDefault saveDBVersion:GIGADB_USER_VER];
}
-(void)upgradUserDBToNew{
if (_userArr.count <= 0) {
GILog(@"there is no user yet");
return;
}
[_store putObject:_userArr withId:self.userTabId intoTable:GIGA_USER_TABLE];
}
@end
+30
View File
@@ -0,0 +1,30 @@
//
// LXCountTimer.h
// Elastagen
//
// Created by lianxiang on 2018/8/12.
// Copyright © 2018年 jijia. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface LXCountTimer : NSObject
/**
* 用时间戳倒计时
* starTimeStamp 开始的时间戳
* finishTimeStamp 结束的时间戳
*/
-(void)countDownWithStratTimeStamp:(long)starTimeStamp finishTimeStamp:(long)finishTimeStamp completeBlock:(void (^)(NSInteger day,NSInteger hour,NSInteger minute,NSInteger second))completeBlock;
/**
* 每秒走一次,回调block
*/
-(void)countDownWithPER_SECBlock:(void (^)(void))PER_SECBlock;
/**
* 销毁倒计时
*/
-(void)destoryTimer;
@end
+93
View File
@@ -0,0 +1,93 @@
//
// LXCountTimer.m
// Elastagen
//
// Created by lianxiang on 2018/8/12.
// Copyright © 2018年 jijia. All rights reserved.
//
#import "LXCountTimer.h"
@interface LXCountTimer()
@property(nonatomic,retain) dispatch_source_t timer;
@property(nonatomic,retain) NSDateFormatter *dateFormatter;
@end
@implementation LXCountTimer
-(void)countDownWithStratTimeStamp:(long)starTimeStamp finishTimeStamp:(long)finishTimeStamp completeBlock:(void (^)(NSInteger, NSInteger, NSInteger, NSInteger))completeBlock{
if (_timer == nil) {
NSDate *finishDate =[self dateWithLong:finishTimeStamp];
NSDate *startDate = [self dateWithLong:starTimeStamp];
NSTimeInterval timerInterval =[finishDate timeIntervalSinceDate:startDate];
__block int timeout = timerInterval;
if (timeout !=0) {
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
_timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue);
dispatch_source_set_timer(_timer, dispatch_walltime(NULL, 0), 1.0*NSEC_PER_SEC, 0);//每秒执行
dispatch_source_set_event_handler(_timer, ^{
if (timeout<=0) {
//记时结束, 关闭
dispatch_source_cancel(self->_timer);
self->_timer = nil;
dispatch_async(dispatch_get_main_queue(), ^{
completeBlock(0,0,0,0);
});
}else{
int days = (int)(timeout/(3600*24));
int hours = (int)((timeout-days*24*3600)/3600);
int minute = (int)(timeout-days*24*3600-hours*3600)/60;
int second = timeout-days*24*3600-hours*3600-minute*60;
dispatch_async(dispatch_get_main_queue(), ^{
completeBlock(days,hours,minute,second);
});
timeout--;
}
});
dispatch_resume(_timer);
}
}
}
-(void)countDownWithPER_SECBlock:(void (^)(void))PER_SECBlock{
if (_timer==nil) {
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
_timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0,queue);
dispatch_source_set_timer(_timer,dispatch_walltime(NULL, 0),1.0*NSEC_PER_SEC, 0); //每秒执行
dispatch_source_set_event_handler(_timer, ^{
dispatch_async(dispatch_get_main_queue(), ^{
PER_SECBlock();
});
});
dispatch_resume(_timer);
}
}
-(void)destoryTimer{
if (_timer) {
dispatch_source_cancel(_timer);
_timer = nil;
}
}
-(void)dealloc{
NSLog(@"%s dealloc",object_getClassName(self));
}
-(NSDate *)dateWithLong:(long)longValue{
long value = longValue;
NSNumber *time = [NSNumber numberWithLong:value];
//转换成NSTimeInterval
NSTimeInterval nsTimeInterval = [time longValue];
NSDate *date = [[NSDate alloc] initWithTimeIntervalSince1970:nsTimeInterval];
return date;
}
@end
File diff suppressed because one or more lines are too long
+69
View File
@@ -0,0 +1,69 @@
//
// GIGA.h
// GIGA
//
// Created by lianxiang on 2018/8/13.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#ifndef GIGA_h
#define GIGA_h
#define UD_STADARDUD [NSUserDefaults standardUserDefaults]
#define UD_REMOVE_KEY(__KEY__) \
[[NSUserDefaults standardUserDefaults] removeObjectForKey:__KEY__]; \
UD_SYNC
#define UD_GET_VALUE(__KEY__) [[NSUserDefaults standardUserDefaults] valueForKey:__KEY__];
#define UD_SET_KEY_VALUE(__KEY__, __VALUE__) \
[[NSUserDefaults standardUserDefaults] setValue:(__VALUE__) forKey:(__KEY__)]; \
UD_SYNC
#define UD_SYNC [[NSUserDefaults standardUserDefaults] synchronize];
// MARK: NotificationCenter - Add
#define NC_ADD_TARGET_NAME_OBJECT(__target__, __sel__, __name__, __object__) [[NSNotificationCenter defaultCenter] addObserver:(__target__) selector:(__sel__) name:(__name__) object:(__object__)];
#define NC_POST_NAME_OBJECT(__name__,__object__) [[NSNotificationCenter defaultCenter] postNotificationName:(__name__) object:(__object__)];
#define NC_REMOVE_NAME(__target__,__name__,__object__) [[NSNotificationCenter defaultCenter] removeObserver:(__target__) name:(__name__) object:(__object__)];
// MAKR: Noti Names
#define USER_GUARD_DISSMISS @"userGaurdDissmiss"
#define APP_GUARD_DISSMISS @"APPGaurdDissmiss"
#define GIGARGB(R,G,B,A) [UIColor colorWithRed:R/255.0f green:G/255.0f blue:B/255.0f alpha:A]
#define GIGAUIColorFromRGB_A(rgbValue,alphaValue) [UIColor \
colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \
green:((float)((rgbValue & 0xFF00) >> 8))/255.0 \
blue:((float)(rgbValue & 0xFF))/255.0 alpha:alphaValue]
#define GIGAUIColorFromRGBA(rgbValue) [UIColor \
colorWithRed:((float)((rgbValue & 0xFF000000) >> 24))/255.0 \
green:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \
blue:((float)((rgbValue & 0xFF00) >> 8))/255.0 \
alpha:((float)(rgbValue & 0xFF))/255.0]
#define SCREEN [UIScreen mainScreen]
#define WIDTH self.view.frame.size.width
#define HEIGHT self.view.frame.size.height
#define KMainW [UIScreen mainScreen].bounds.size.width
#define KMainH [UIScreen mainScreen].bounds.size.height
#define ISIOS8 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0 ? YES : NO)
#define ISIOS9 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 9.0 ? YES : NO)
#define ISIOS10 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 10.0 ? YES : NO)
#define weakify(var) __weak typeof(var) weakSelf = var
#define strongify(var) __strong typeof(var) strongSelf = var
#define textFontWeightSize(X,W) [UIFont systemFontOfSize:X *([UIScreen mainScreen].bounds.size.width / 320.0) weight:W]
#endif /* GIGA_h */
+16
View File
@@ -0,0 +1,16 @@
//
// GiGaServerConfig.h
// GIGA
//
// Created by lianxiang on 2018/8/13.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface GiGaServerConfig : NSObject
+ (void)setServerType:(NSInteger) type;
+ (NSString *)getMainUrl;
@end
+38
View File
@@ -0,0 +1,38 @@
//
// GiGaServerConfig.m
// GIGA
//
// Created by lianxiang on 2018/8/13.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import "GiGaServerConfig.h"
@implementation GiGaServerConfig
+ (void)setServerType:(NSInteger)type
{
#if defined(DEBUG) || defined(RELEASE_VERTION_TEST)
#endif
switch (type) {
case 0://测试环境
{
[[NSUserDefaults standardUserDefaults] setValue:@"https://" forKey:@"MainUrl"];
} break;
case 1: //生产环境
{
[[NSUserDefaults standardUserDefaults] setValue:@"https://" forKey:@"MainUrl"];
} break;
default:
break;
}
}
+ (NSString *)getMainUrl
{
return [[NSUserDefaults standardUserDefaults] objectForKey:@"MainUrl"];
}
@end
+22
View File
@@ -0,0 +1,22 @@
//
// GIGA.pch
// GIGA
//
// Created by lianxiang on 2018/8/13.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#ifndef GIGA_pch
#define GIGA_pch
// Include any system framework and library headers here that should be included in all compilation units.
// You will also need to set the Prefix Header build setting of one or more of your targets to reference this file.
#import "GIGA.h"
#ifdef DEBUG
#define GILog(fmt,...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
#else
#define GILog(...)
#endif
#endif /* GIGA_pch */
+7
View File
@@ -2,8 +2,15 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>MaskTime</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
@@ -0,0 +1,13 @@
//
// GiGaExercisesViewController.h
// GIGA
//
// Created by lianxiang on 2018/8/13.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface GiGaExercisesViewController : UIViewController
@end
@@ -0,0 +1,37 @@
//
// GiGaExercisesViewController.m
// GIGA
//
// Created by lianxiang on 2018/8/13.
// Copyright © 2018 com.giga.ios. All rights reserved.
//
#import "GiGaExercisesViewController.h"
@interface GiGaExercisesViewController ()
@end
@implementation GiGaExercisesViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
@@ -0,0 +1,13 @@
//
// GiGaRegistViewController.h
// GIGA
//
// Created by lianxiang on 2018/8/21.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface GiGaRegistViewController : UIViewController
@end
@@ -0,0 +1,102 @@
//
// GiGaRegistViewController.m
// GIGA
//
// Created by lianxiang on 2018/8/21.
// Copyright © 2018 com.giga.ios. All rights reserved.
//
#import "GiGaRegistViewController.h"
#import "TTTAttributedLabel.h"
#import "GiGaWebViewController.h"
@interface GiGaRegistViewController ()<TTTAttributedLabelDelegate>
@property (weak, nonatomic) IBOutlet UITextField *phoneNumberTextField;
@property (weak, nonatomic) IBOutlet UITextField *codeTextField;
@property (weak, nonatomic) IBOutlet UIButton *sendCodeBtn;
@property (weak, nonatomic) IBOutlet UITextField *passTexFied;
@property (weak, nonatomic) IBOutlet UIButton *checkBtn;
@property (weak, nonatomic) IBOutlet UIButton *registBtn;
@property (weak, nonatomic) IBOutlet TTTAttributedLabel *useragreementLabel;
@end
@implementation GiGaRegistViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.title = @"注册";
// Do any additional setup after loading the view from its nib.
[self confirmUI];
}
-(void)confirmUI{
self.useragreementLabel.highlightedTextColor = [UIColor lightGrayColor];
self.useragreementLabel.delegate = self;
self.useragreementLabel.enabledTextCheckingTypes= NSTextCheckingTypePhoneNumber|NSTextCheckingTypeAddress|NSTextCheckingTypeLink;
self.useragreementLabel.linkAttributes = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:NO] forKey:(NSString *)kCTUnderlineStyleAttributeName];
//NSTextCheckingTypeLink;
NSString *text = @"已阅读并同意《用户服务协议》";
[self.useragreementLabel setText:text afterInheritingLabelAttributesAndConfiguringWithBlock:^NSMutableAttributedString *(NSMutableAttributedString *mutableAttributedString) {
NSRange fontRange = [[mutableAttributedString string] rangeOfString:@"用户服务协议" options:NSCaseInsensitiveSearch];
UIFont* sysFont = [UIFont systemFontOfSize:15];
CTFontRef font = CTFontCreateWithName((__bridge CFStringRef)sysFont.fontName, sysFont.pointSize, NULL);
if (font) {
[mutableAttributedString addAttribute:(NSString *)kCTFontAttributeName value:(__bridge id)font range:fontRange];
[mutableAttributedString addAttribute:(NSString *)kCTForegroundColorAttributeName value:(__bridge id)[[UIColor greenColor] CGColor] range:fontRange];
}
return mutableAttributedString;
}];
NSRange fontRange = [text rangeOfString:@"用户服务协议" options:NSCaseInsensitiveSearch];
[self.useragreementLabel addLinkToTransitInformation:@{
@"SourceName":@"useragreement"
} withRange:fontRange];
}
#pragma mark - TTTAttributedLabelDelegate
-(void)attributedLabel:(TTTAttributedLabel *)label didSelectLinkWithURL:(NSURL *)url
{
}
-(void)attributedLabel:(TTTAttributedLabel *)label didSelectLinkWithTransitInformation:(NSDictionary *)components
{
NSLog(@"components%@",components);
// GiGaWebViewController *webView = [[GiGaWebViewController alloc] init];
// webView.souceType = WebSourceTypeLoacalHtml;
// webView.fileName = components[@"SourceName"];
// [self.navigationController pushViewController:webView animated:YES];
GiGaWebViewController *webView = [[GiGaWebViewController alloc] init];
webView.souceType = WebSourceTypeUrlLink;
webView.url = @"http://www.youtansu.com";
[self.navigationController pushViewController:webView animated:YES];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
@@ -0,0 +1,157 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="GiGaRegistViewController">
<connections>
<outlet property="checkBtn" destination="b06-w9-r2g" id="Cv8-zo-QoL"/>
<outlet property="codeTextField" destination="dR7-iu-Eup" id="wNt-AE-gpM"/>
<outlet property="passTexFied" destination="UUC-74-fsa" id="4hR-y9-jDa"/>
<outlet property="phoneNumberTextField" destination="uJG-KF-a91" id="Pr4-XG-hZQ"/>
<outlet property="registBtn" destination="hZA-nj-Wmu" id="075-qU-XS3"/>
<outlet property="sendCodeBtn" destination="qAH-Fa-AmF" id="jh3-Ug-Whq"/>
<outlet property="useragreementLabel" destination="Vxb-TL-wDd" id="0Uj-cv-1Di"/>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="SEO-0F-Irb">
<rect key="frame" x="145" y="75" width="84" height="84"/>
<color key="backgroundColor" red="0.19801172859999999" green="0.55107868019999995" blue="0.17657151269999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="width" constant="84" id="Ac0-Im-dQ0"/>
<constraint firstAttribute="width" secondItem="SEO-0F-Irb" secondAttribute="height" multiplier="1:1" id="o6U-yH-mAL"/>
</constraints>
</imageView>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder=" 请输入手机号" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="uJG-KF-a91">
<rect key="frame" x="36" y="183" width="303" height="40"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="HLZ-Al-gsF"/>
</constraints>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="短信验证码" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="dR7-iu-Eup">
<rect key="frame" x="36" y="241" width="303" height="40"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="kFj-lZ-f1b"/>
</constraints>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="设置登录密码" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="UUC-74-fsa">
<rect key="frame" x="36" y="298" width="303" height="40"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="ZXN-7M-Ya1"/>
</constraints>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ubQ-Za-dV7">
<rect key="frame" x="36" y="231" width="303" height="1"/>
<color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="ZnO-2U-V61"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Trq-bz-kQT">
<rect key="frame" x="36" y="289" width="303" height="1"/>
<color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="VhP-k3-4oj"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Pb5-1e-TXp">
<rect key="frame" x="36" y="346" width="303" height="1"/>
<color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="p8o-Oo-C9M"/>
</constraints>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="qAH-Fa-AmF">
<rect key="frame" x="242" y="237" width="87" height="48"/>
<constraints>
<constraint firstAttribute="width" constant="87" id="HC3-fN-xKP"/>
<constraint firstAttribute="height" constant="48" id="iQo-1Y-aPA"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<state key="normal" title="发送验证码">
<color key="titleColor" white="0.33333333329999998" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</state>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="b06-w9-r2g">
<rect key="frame" x="36" y="373" width="33" height="27"/>
<color key="backgroundColor" red="0.19801172859999999" green="0.55107868019999995" blue="0.17657151269999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="27" id="TwO-WB-jNy"/>
<constraint firstAttribute="width" constant="33" id="n2h-mQ-iLM"/>
</constraints>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="hZA-nj-Wmu">
<rect key="frame" x="36" y="434" width="303" height="48"/>
<color key="backgroundColor" red="0.19801172859999999" green="0.55107868019999995" blue="0.17657151269999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="48" id="1ii-ua-NM2"/>
</constraints>
<state key="normal" title="注 册"/>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Vxb-TL-wDd" customClass="TTTAttributedLabel">
<rect key="frame" x="77" y="376" width="42" height="21"/>
<fontDescription key="fontDescription" name=".AppleSystemUIFont" family=".AppleSystemUIFont" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="uJG-KF-a91" firstAttribute="centerX" secondItem="Q5M-cg-NOt" secondAttribute="centerX" id="3lK-sI-SIL"/>
<constraint firstItem="qAH-Fa-AmF" firstAttribute="leading" secondItem="dR7-iu-Eup" secondAttribute="trailing" constant="-97" id="68S-uL-NWf"/>
<constraint firstItem="hZA-nj-Wmu" firstAttribute="centerX" secondItem="Q5M-cg-NOt" secondAttribute="centerX" id="8oy-SI-wjc"/>
<constraint firstItem="uJG-KF-a91" firstAttribute="top" secondItem="SEO-0F-Irb" secondAttribute="bottom" constant="24" id="9KB-zh-0Iv"/>
<constraint firstItem="UUC-74-fsa" firstAttribute="width" secondItem="uJG-KF-a91" secondAttribute="width" id="AxW-2N-oD9"/>
<constraint firstItem="b06-w9-r2g" firstAttribute="leading" secondItem="Pb5-1e-TXp" secondAttribute="leading" id="BTF-Y0-iHe"/>
<constraint firstItem="Vxb-TL-wDd" firstAttribute="leading" secondItem="b06-w9-r2g" secondAttribute="trailing" constant="8" id="Dc3-Gz-cl5"/>
<constraint firstItem="Pb5-1e-TXp" firstAttribute="centerX" secondItem="Q5M-cg-NOt" secondAttribute="centerX" id="ETi-1w-mRx"/>
<constraint firstItem="qAH-Fa-AmF" firstAttribute="centerY" secondItem="dR7-iu-Eup" secondAttribute="centerY" id="G6I-E3-lox"/>
<constraint firstItem="Trq-bz-kQT" firstAttribute="centerX" secondItem="Q5M-cg-NOt" secondAttribute="centerX" id="GsV-nH-ZTs"/>
<constraint firstItem="SEO-0F-Irb" firstAttribute="centerX" secondItem="Q5M-cg-NOt" secondAttribute="centerX" id="HKT-sW-HzQ"/>
<constraint firstItem="Vxb-TL-wDd" firstAttribute="centerY" secondItem="b06-w9-r2g" secondAttribute="centerY" id="M1g-x2-bC1"/>
<constraint firstItem="ubQ-Za-dV7" firstAttribute="top" secondItem="uJG-KF-a91" secondAttribute="bottom" constant="8" id="QhR-31-HPa"/>
<constraint firstItem="Pb5-1e-TXp" firstAttribute="width" secondItem="UUC-74-fsa" secondAttribute="width" id="Sd7-d5-Uht"/>
<constraint firstItem="Trq-bz-kQT" firstAttribute="top" secondItem="dR7-iu-Eup" secondAttribute="bottom" constant="8" id="WSq-Ss-0Ac"/>
<constraint firstItem="SEO-0F-Irb" firstAttribute="top" secondItem="Q5M-cg-NOt" secondAttribute="top" constant="55" id="Xk1-QJ-vEV"/>
<constraint firstItem="uJG-KF-a91" firstAttribute="leading" secondItem="Q5M-cg-NOt" secondAttribute="leading" constant="36" id="cUx-ne-9fl"/>
<constraint firstItem="dR7-iu-Eup" firstAttribute="top" secondItem="ubQ-Za-dV7" secondAttribute="bottom" constant="9" id="cnf-kX-9T5"/>
<constraint firstItem="dR7-iu-Eup" firstAttribute="width" secondItem="uJG-KF-a91" secondAttribute="width" id="d0L-Yy-an6"/>
<constraint firstItem="dR7-iu-Eup" firstAttribute="centerX" secondItem="Q5M-cg-NOt" secondAttribute="centerX" id="fDj-om-PCx"/>
<constraint firstItem="ubQ-Za-dV7" firstAttribute="centerX" secondItem="Q5M-cg-NOt" secondAttribute="centerX" id="fcn-EO-FSA"/>
<constraint firstItem="b06-w9-r2g" firstAttribute="top" secondItem="Pb5-1e-TXp" secondAttribute="bottom" constant="26" id="kHK-na-vql"/>
<constraint firstItem="hZA-nj-Wmu" firstAttribute="leading" secondItem="b06-w9-r2g" secondAttribute="leading" id="nSQ-58-vgR"/>
<constraint firstItem="UUC-74-fsa" firstAttribute="top" secondItem="Trq-bz-kQT" secondAttribute="bottom" constant="8" id="pft-bZ-H5z"/>
<constraint firstItem="UUC-74-fsa" firstAttribute="centerX" secondItem="Q5M-cg-NOt" secondAttribute="centerX" id="pth-LZ-Cdm"/>
<constraint firstItem="ubQ-Za-dV7" firstAttribute="width" secondItem="uJG-KF-a91" secondAttribute="width" id="sAe-4S-EEP"/>
<constraint firstItem="Pb5-1e-TXp" firstAttribute="top" secondItem="UUC-74-fsa" secondAttribute="bottom" constant="8" id="trq-E6-Qag"/>
<constraint firstItem="Trq-bz-kQT" firstAttribute="width" secondItem="dR7-iu-Eup" secondAttribute="width" id="xA0-yc-8lb"/>
<constraint firstItem="hZA-nj-Wmu" firstAttribute="top" secondItem="b06-w9-r2g" secondAttribute="bottom" constant="34" id="xPR-Yh-hFk"/>
</constraints>
<viewLayoutGuide key="safeArea" id="Q5M-cg-NOt"/>
<point key="canvasLocation" x="33.5" y="53.5"/>
</view>
</objects>
</document>
@@ -0,0 +1,13 @@
//
// GiGaUserLoginVC.h
// GIGA
//
// Created by lianxiang on 2018/8/20.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import "GiGaBaseNavViewController.h"
@interface GiGaUserLoginVC : UIViewController
@end
@@ -0,0 +1,110 @@
//
// GiGaUserLoginVC.m
// GIGA
//
// Created by lianxiang on 2018/8/20.
// Copyright © 2018 com.giga.ios. All rights reserved.
//
#import "GiGaUserLoginVC.h"
#import "UINavigationBar+Custom.h"
#import "PassWordResetVC.h"
#import "GiGaRegistViewController.h"
@interface GiGaUserLoginVC ()
@property (weak, nonatomic) IBOutlet UIImageView *userImagView;
@property (weak, nonatomic) IBOutlet UITextField *acountTextField;
@property (weak, nonatomic) IBOutlet UITextField *passwordTextField;
@property (weak, nonatomic) IBOutlet UIButton *loginBtn;
@property (weak, nonatomic) IBOutlet UIButton *weiXinLoginBtn;
@property (weak, nonatomic) IBOutlet UIButton *registBtn;
@end
@implementation GiGaUserLoginVC
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
[self setUpX];
[self textFieldUI];
[self.registBtn addTarget:self action:@selector(registBtnAction) forControlEvents:UIControlEventTouchUpInside];
}
-(void)setUpX{
UIButton *rightBtn = [UIButton buttonWithType:UIButtonTypeCustom];
rightBtn.frame = CGRectMake(0, 0, 40, 40);
rightBtn.backgroundColor = [UIColor blueColor];
[rightBtn setImage:[UIImage imageNamed:@"maske_dismiss_waring"] forState:UIControlStateNormal];
[rightBtn addTarget:self action:@selector(rightBtnAction) forControlEvents:UIControlEventTouchUpInside];
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:rightBtn];
}
-(void)textFieldUI{
[self.acountTextField setValue:[UIColor colorWithRed:153/255.0f green:153/255.0f blue:153/255.0f alpha:1] forKey:@"_placeholderLabel.textColor"];
UIView *acountView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
acountView.backgroundColor = [UIColor redColor];
UIImageView *acountViewIcon = [[UIImageView alloc] initWithFrame:CGRectMake(15, 5, 16, 18)];
acountViewIcon.image = [UIImage imageNamed:@""];
[acountView addSubview:acountViewIcon];
self.acountTextField.leftView = acountView;
self.acountTextField.leftViewMode = UITextFieldViewModeAlways;
[self.passwordTextField setValue:[UIColor colorWithRed:153/255.0f green:153/255.0f blue:153/255.0f alpha:1] forKey:@"_placeholderLabel.textColor"];
UIView *passView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
passView.backgroundColor = [UIColor redColor];
UIImageView *passViewIcon = [[UIImageView alloc] initWithFrame:CGRectMake(15, 5, 16, 18)];
passViewIcon.image = [UIImage imageNamed:@""];
[passView addSubview:passViewIcon];
self.passwordTextField.leftView = passView;
self.passwordTextField.leftViewMode = UITextFieldViewModeAlways;
self.loginBtn.layer.masksToBounds = YES;
self.loginBtn.layer.cornerRadius = self.loginBtn.frame.size.height / 2;
self.weiXinLoginBtn.layer.masksToBounds = YES;
self.weiXinLoginBtn.layer.cornerRadius = self.weiXinLoginBtn.frame.size.height / 2;
}
-(void)rightBtnAction{
[self dismissViewControllerAnimated:YES completion:nil];
}
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
[self.navigationController.navigationBar setClearNav];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)forgetPassBtn:(id)sender {
PassWordResetVC *passVC= [[PassWordResetVC alloc] init];
[self.navigationController pushViewController:passVC animated:YES];
}
-(void)registBtnAction{
GiGaRegistViewController *registVC = [[GiGaRegistViewController alloc] init];
[self.navigationController pushViewController:registVC animated:YES];
}
@end
@@ -0,0 +1,175 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="GiGaUserLoginVC">
<connections>
<outlet property="acountTextField" destination="Yiv-h8-4V1" id="bT2-8W-ab2"/>
<outlet property="loginBtn" destination="8Of-JP-gMR" id="uRE-2y-IZt"/>
<outlet property="passwordTextField" destination="Y1I-OE-6t1" id="Jgj-sC-7MX"/>
<outlet property="registBtn" destination="F5p-cf-frr" id="eHE-mU-8Xf"/>
<outlet property="userImagView" destination="RIl-8E-GcR" id="lhE-Hq-pRn"/>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
<outlet property="weiXinLoginBtn" destination="dnL-WV-spY" id="UQI-ZD-Wuu"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="RIl-8E-GcR">
<rect key="frame" x="137" y="64" width="100" height="100"/>
<color key="backgroundColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="width" secondItem="RIl-8E-GcR" secondAttribute="height" multiplier="1:1" id="kf7-fa-NKy"/>
<constraint firstAttribute="height" constant="100" id="npT-8X-kmx"/>
</constraints>
</imageView>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="账号" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="Yiv-h8-4V1">
<rect key="frame" x="32" y="180" width="309" height="30"/>
<color key="backgroundColor" red="0.99607843139999996" green="0.94117647059999998" blue="0.69803921570000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="30" id="LOI-yC-v4S"/>
</constraints>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<textInputTraits key="textInputTraits"/>
</textField>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="密码" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="Y1I-OE-6t1">
<rect key="frame" x="33" y="244" width="309" height="30"/>
<color key="backgroundColor" red="0.99607843139999996" green="0.94117647059999998" blue="0.69803921570000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="30" id="eG3-4a-G4H"/>
</constraints>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<textInputTraits key="textInputTraits"/>
</textField>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="qzA-vE-CGR">
<rect key="frame" x="33" y="214" width="309" height="1"/>
<color key="backgroundColor" red="0.74901960779999999" green="0.74509803919999995" blue="0.74509803919999995" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="Nz8-a3-phJ"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ZJU-Uo-5TM">
<rect key="frame" x="33.5" y="279" width="309" height="1"/>
<color key="backgroundColor" red="0.74901960779999999" green="0.74509803919999995" blue="0.74509803919999995" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="NqZ-5s-7Mg"/>
</constraints>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="chq-bd-6sQ">
<rect key="frame" x="281" y="295" width="60" height="30"/>
<constraints>
<constraint firstAttribute="height" constant="30" id="3Nq-gh-4BK"/>
<constraint firstAttribute="width" constant="60" id="Pv8-8w-ASz"/>
</constraints>
<fontDescription key="fontDescription" type="boldSystem" pointSize="12"/>
<state key="normal" title="忘记密码">
<color key="titleColor" red="0.19801172859999999" green="0.55107868019999995" blue="0.17657151269999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<connections>
<action selector="forgetPassBtn:" destination="-1" eventType="touchUpInside" id="GR3-Gw-sRB"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="8Of-JP-gMR">
<rect key="frame" x="33" y="357" width="309" height="42"/>
<color key="backgroundColor" red="0.19801172859999999" green="0.55107868019999995" blue="0.17657151269999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="42" id="0l3-lV-ZMK"/>
</constraints>
<fontDescription key="fontDescription" name=".PingFangSC-Regular" family=".PingFang SC" pointSize="15"/>
<state key="normal" title=" 登 录">
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</state>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="F5p-cf-frr">
<rect key="frame" x="144" y="419" width="87" height="30"/>
<constraints>
<constraint firstAttribute="width" constant="87" id="7xs-hL-39d"/>
<constraint firstAttribute="height" constant="30" id="Q2v-So-LQo"/>
</constraints>
<state key="normal" title="创建账号"/>
</button>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Qbr-kJ-U7P">
<rect key="frame" x="33" y="510" width="129" height="1"/>
<color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="95X-YC-qXA"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="mxE-Tx-0Us">
<rect key="frame" x="220" y="510" width="122" height="1"/>
<color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="bG5-pf-mm7"/>
</constraints>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="OR" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5Zl-ot-dVW">
<rect key="frame" x="175.5" y="500" width="24" height="21"/>
<constraints>
<constraint firstAttribute="width" constant="24" id="2XR-pF-nnJ"/>
<constraint firstAttribute="height" constant="21" id="bg5-RC-uB6"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" white="0.66666666669999997" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="dnL-WV-spY">
<rect key="frame" x="33" y="535" width="309" height="50"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="rYQ-VZ-BLB"/>
</constraints>
<state key="normal" title="微信账号登录"/>
</button>
</subviews>
<constraints>
<constraint firstItem="mxE-Tx-0Us" firstAttribute="centerY" secondItem="5Zl-ot-dVW" secondAttribute="centerY" id="3cA-BV-qmd"/>
<constraint firstItem="RIl-8E-GcR" firstAttribute="centerX" secondItem="Q5M-cg-NOt" secondAttribute="centerX" id="4eY-sT-DtU"/>
<constraint firstItem="dnL-WV-spY" firstAttribute="top" secondItem="5Zl-ot-dVW" secondAttribute="bottom" constant="14" id="65m-zQ-bWl"/>
<constraint firstItem="RIl-8E-GcR" firstAttribute="top" secondItem="Q5M-cg-NOt" secondAttribute="top" constant="44" id="6CN-xC-x9g"/>
<constraint firstItem="5Zl-ot-dVW" firstAttribute="leading" secondItem="Qbr-kJ-U7P" secondAttribute="trailing" constant="13.5" id="7Lh-zH-OQP"/>
<constraint firstItem="ZJU-Uo-5TM" firstAttribute="width" secondItem="Y1I-OE-6t1" secondAttribute="width" id="7og-vA-Mtc"/>
<constraint firstItem="chq-bd-6sQ" firstAttribute="top" secondItem="ZJU-Uo-5TM" secondAttribute="bottom" constant="15" id="7th-F3-6VD"/>
<constraint firstItem="Qbr-kJ-U7P" firstAttribute="leading" secondItem="8Of-JP-gMR" secondAttribute="leading" id="ANZ-UH-EG0"/>
<constraint firstItem="8Of-JP-gMR" firstAttribute="width" secondItem="Yiv-h8-4V1" secondAttribute="width" id="EiB-Tt-lhg"/>
<constraint firstItem="Q5M-cg-NOt" firstAttribute="trailing" secondItem="chq-bd-6sQ" secondAttribute="trailing" constant="34" id="FIt-sy-fp4"/>
<constraint firstItem="8Of-JP-gMR" firstAttribute="top" secondItem="chq-bd-6sQ" secondAttribute="bottom" constant="32" id="I92-Z4-DAA"/>
<constraint firstItem="5Zl-ot-dVW" firstAttribute="centerX" secondItem="Q5M-cg-NOt" secondAttribute="centerX" id="LX6-0I-g2t"/>
<constraint firstItem="dnL-WV-spY" firstAttribute="centerX" secondItem="Q5M-cg-NOt" secondAttribute="centerX" id="Lpn-U1-2EJ"/>
<constraint firstItem="ZJU-Uo-5TM" firstAttribute="top" secondItem="Y1I-OE-6t1" secondAttribute="bottom" constant="5" id="O7c-yh-TU1"/>
<constraint firstItem="Y1I-OE-6t1" firstAttribute="width" secondItem="Yiv-h8-4V1" secondAttribute="width" id="Po4-UD-7zT"/>
<constraint firstItem="Yiv-h8-4V1" firstAttribute="top" secondItem="RIl-8E-GcR" secondAttribute="bottom" constant="16" id="PoW-PW-M0w"/>
<constraint firstItem="Yiv-h8-4V1" firstAttribute="centerX" secondItem="Q5M-cg-NOt" secondAttribute="centerX" constant="-1" id="RNt-vj-zPW"/>
<constraint firstItem="5Zl-ot-dVW" firstAttribute="top" secondItem="F5p-cf-frr" secondAttribute="bottom" constant="51" id="TfU-BV-iUe"/>
<constraint firstItem="Yiv-h8-4V1" firstAttribute="leading" secondItem="Q5M-cg-NOt" secondAttribute="leading" constant="32" id="Ux4-8Q-gMv"/>
<constraint firstItem="ZJU-Uo-5TM" firstAttribute="centerX" secondItem="Q5M-cg-NOt" secondAttribute="centerX" id="V04-2u-unZ"/>
<constraint firstItem="mxE-Tx-0Us" firstAttribute="leading" secondItem="5Zl-ot-dVW" secondAttribute="trailing" constant="20.5" id="VOs-rR-tew"/>
<constraint firstItem="qzA-vE-CGR" firstAttribute="centerX" secondItem="Q5M-cg-NOt" secondAttribute="centerX" id="WN4-SB-6Dy"/>
<constraint firstItem="mxE-Tx-0Us" firstAttribute="trailing" secondItem="8Of-JP-gMR" secondAttribute="trailing" id="aZs-4P-9iv"/>
<constraint firstItem="dnL-WV-spY" firstAttribute="width" secondItem="8Of-JP-gMR" secondAttribute="width" id="asA-dV-Wmj"/>
<constraint firstItem="Y1I-OE-6t1" firstAttribute="centerX" secondItem="Q5M-cg-NOt" secondAttribute="centerX" id="c3z-29-UwW"/>
<constraint firstItem="Qbr-kJ-U7P" firstAttribute="centerY" secondItem="5Zl-ot-dVW" secondAttribute="centerY" id="d9i-fK-2UN"/>
<constraint firstItem="qzA-vE-CGR" firstAttribute="top" secondItem="Yiv-h8-4V1" secondAttribute="bottom" constant="4" id="e5U-rz-XHX"/>
<constraint firstItem="F5p-cf-frr" firstAttribute="top" secondItem="8Of-JP-gMR" secondAttribute="bottom" constant="20" id="fJY-wF-KYT"/>
<constraint firstItem="8Of-JP-gMR" firstAttribute="centerX" secondItem="Q5M-cg-NOt" secondAttribute="centerX" id="pOm-hg-pge"/>
<constraint firstItem="Y1I-OE-6t1" firstAttribute="top" secondItem="qzA-vE-CGR" secondAttribute="bottom" constant="29" id="tBz-sj-jET"/>
<constraint firstItem="F5p-cf-frr" firstAttribute="centerX" secondItem="Q5M-cg-NOt" secondAttribute="centerX" id="uNF-sL-Kjk"/>
<constraint firstItem="qzA-vE-CGR" firstAttribute="width" secondItem="Yiv-h8-4V1" secondAttribute="width" id="ukd-Wg-7Qy"/>
</constraints>
<viewLayoutGuide key="safeArea" id="Q5M-cg-NOt"/>
<point key="canvasLocation" x="33.5" y="53.5"/>
</view>
</objects>
</document>
@@ -0,0 +1,24 @@
//
// GiGaWebViewController.h
// GIGA
//
// Created by lianxiang on 2018/8/21.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import <UIKit/UIKit.h>
typedef NS_ENUM(NSInteger,WebSourceType)
{
WebSourceTypeLoacalHtml,
WebSourceTypeUrlLink
};
@interface GiGaWebViewController : UIViewController
@property (nonatomic,strong) NSString *url;
@property (nonatomic,assign) WebSourceType souceType;
@property (nonatomic,strong) NSString *fileName;
@end
@@ -0,0 +1,122 @@
//
// GiGaWebViewController.m
// GIGA
//
// Created by lianxiang on 2018/8/21.
// Copyright © 2018 com.giga.ios. All rights reserved.
//
#import "GiGaWebViewController.h"
#import "NJKWebViewProgressView.h"
#import "NJKWebViewProgress.h"
#import "UIView+Toast.h"
@interface GiGaWebViewController ()<UIWebViewDelegate,NJKWebViewProgressDelegate>
{
NJKWebViewProgressView *_progressView;
NJKWebViewProgress *_progressProxy;
}
@property (weak, nonatomic) IBOutlet UIWebView *webview;
@end
@implementation GiGaWebViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
_progressProxy = [[NJKWebViewProgress alloc] init];
_webview.delegate = _progressProxy;
_progressProxy.webViewProxyDelegate = self;
_progressProxy.progressDelegate = self;
CGRect navBounds = self.navigationController.navigationBar.bounds;
CGRect barFrame = CGRectMake(0,
navBounds.size.height - 2,
navBounds.size.width,2);
_progressView = [[NJKWebViewProgressView alloc] initWithFrame:barFrame];
_progressView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin;
[_progressView setProgress:0 animated:YES];
[self loadWeb];
}
-(void)viewWillAppear:(BOOL)animated{
[self.navigationController.navigationBar addSubview:_progressView];
}
-(void)viewWillDisappear:(BOOL)animated{
[_progressView removeFromSuperview];
}
-(void)loadWeb{
switch (self.souceType) {
case WebSourceTypeUrlLink:
{
if (!self.url) {
[self.view makeToast:@"链接为空" duration:1 position:CSToastPositionCenter];
return;
}
NSURLRequest *req = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:self.url]];
[_webview loadRequest:req];
}
break;
case WebSourceTypeLoacalHtml:
{
if (!self.fileName) {
[self.view makeToast:@"无此文件" duration:1 position:CSToastPositionCenter];
return;
}
NSString *filepath = [[NSBundle mainBundle] pathForResource: self.fileName ofType:@"html"];
NSString *html = [NSString stringWithContentsOfFile:filepath encoding:NSUTF8StringEncoding error:nil];
[_webview loadHTMLString:html baseURL:[NSURL URLWithString:filepath]];
}
break;
default:
break;
}
}
#pragma mark -NJKWebViewProgressDelegate
-(void)webViewProgress:(NJKWebViewProgress *)webViewProgress updateProgress:(float)progress{
[_progressView setProgress:progress animated:YES];
self.title = [_webview stringByEvaluatingJavaScriptFromString:@"document.title"];
NSLog(@"%@",self.title);
}
- (void)webViewDidStartLoad:(UIWebView *)webView{
NSLog(@"startLoad");
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
}
-(void)webViewDidFinishLoad:(UIWebView *)webView{
NSLog(@"finishLoad");
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
}
-(void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error{
NSLog(@"error:%@",error);
[_progressView setProgress:0 animated:NO];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (void)removeCookies {
NSHTTPCookieStorage *cookies = [NSHTTPCookieStorage sharedHTTPCookieStorage];
NSArray *pcookies = [cookies cookiesForURL:[NSURL URLWithString:self.url]];
for (NSHTTPCookie *cookie in pcookies) {
[cookies deleteCookie:cookie];
}
}
@end
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="GiGaWebViewController">
<connections>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
<outlet property="webview" destination="sjU-k1-sKC" id="ad6-ii-RNW"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<webView contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="sjU-k1-sKC">
<rect key="frame" x="0.0" y="20" width="375" height="627"/>
<color key="backgroundColor" red="0.36078431370000003" green="0.38823529410000002" blue="0.4039215686" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</webView>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="sjU-k1-sKC" firstAttribute="top" secondItem="Q5M-cg-NOt" secondAttribute="top" id="4TK-3i-ZCu"/>
<constraint firstItem="sjU-k1-sKC" firstAttribute="bottom" secondItem="Q5M-cg-NOt" secondAttribute="bottom" constant="-20" id="7ku-Eb-39H"/>
<constraint firstItem="sjU-k1-sKC" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="RaA-Zb-VXm"/>
<constraint firstAttribute="trailing" secondItem="sjU-k1-sKC" secondAttribute="trailing" id="cjE-bV-s6d"/>
</constraints>
<viewLayoutGuide key="safeArea" id="Q5M-cg-NOt"/>
<point key="canvasLocation" x="33.5" y="53.5"/>
</view>
</objects>
</document>
@@ -0,0 +1,13 @@
//
// PassWordResetVC.h
// GIGA
//
// Created by lianxiang on 2018/8/21.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface PassWordResetVC : UIViewController
@end
@@ -0,0 +1,79 @@
//
// PassWordResetVC.m
// GIGA
//
// Created by lianxiang on 2018/8/21.
// Copyright © 2018 com.giga.ios. All rights reserved.
//
#import "PassWordResetVC.h"
@interface PassWordResetVC ()
@property (weak, nonatomic) IBOutlet UITextField *phoneNumberTextField;
@property (weak, nonatomic) IBOutlet UITextField *codeTextField;
@property (weak, nonatomic) IBOutlet UIButton *codeSendBtn;
@property (weak, nonatomic) IBOutlet UITextField *passNewTextField;
@property (weak, nonatomic) IBOutlet UIButton *confirmBtn;
@end
@implementation PassWordResetVC
- (void)viewDidLoad {
[super viewDidLoad];
self.title = @"重置密码";
// Do any additional setup after loading the view from its nib.
[self confirmUI];
}
-(void)confirmUI{
[self.phoneNumberTextField setValue:[UIColor colorWithRed:153/255.0f green:153/255.0f blue:153/255.0f alpha:1] forKey:@"_placeholderLabel.textColor"];
UIView *phoneView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
phoneView.backgroundColor = [UIColor redColor];
UIImageView *phoneIcon = [[UIImageView alloc] initWithFrame:CGRectMake(15, 5, 16, 18)];
phoneIcon.image = [UIImage imageNamed:@""];
[phoneView addSubview:phoneIcon];
self.phoneNumberTextField.leftView = phoneView;
self.phoneNumberTextField.leftViewMode = UITextFieldViewModeAlways;
[self.codeTextField setValue:[UIColor colorWithRed:153/255.0f green:153/255.0f blue:153/255.0f alpha:1] forKey:@"_placeholderLabel.textColor"];
UIView *codeView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
codeView.backgroundColor = [UIColor redColor];
UIImageView *codeIcon = [[UIImageView alloc] initWithFrame:CGRectMake(15, 5, 16, 18)];
codeIcon.image = [UIImage imageNamed:@""];
[codeView addSubview:codeIcon];
self.codeTextField.leftView = codeView;
self.codeTextField.leftViewMode = UITextFieldViewModeAlways;
[self.passNewTextField setValue:[UIColor colorWithRed:153/255.0f green:153/255.0f blue:153/255.0f alpha:1] forKey:@"_placeholderLabel.textColor"];
UIView *passView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
passView.backgroundColor = [UIColor redColor];
UIImageView *passIcon = [[UIImageView alloc] initWithFrame:CGRectMake(15, 5, 16, 18)];
passIcon.image = [UIImage imageNamed:@""];
[passView addSubview:passIcon];
self.passNewTextField.leftView = passView;
self.passNewTextField.leftViewMode = UITextFieldViewModeAlways;
self.confirmBtn.layer.masksToBounds = YES;
self.confirmBtn.layer.cornerRadius = self.confirmBtn.frame.size.height / 2;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
@@ -0,0 +1,129 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="PassWordResetVC">
<connections>
<outlet property="codeSendBtn" destination="Dv2-ja-F8y" id="T0c-bf-ldg"/>
<outlet property="codeTextField" destination="nCj-Hg-8pQ" id="wO0-kR-CDB"/>
<outlet property="confirmBtn" destination="w3j-WU-gmW" id="M1V-lY-rTu"/>
<outlet property="passNewTextField" destination="MHD-nb-UXj" id="saF-ZL-bv8"/>
<outlet property="phoneNumberTextField" destination="gY9-PP-yev" id="M4O-zE-3Md"/>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="输入手机号" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="gY9-PP-yev">
<rect key="frame" x="43" y="117" width="289" height="40"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="yoq-8B-w5c"/>
</constraints>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="eTv-jk-ONL">
<rect key="frame" x="43" y="165" width="289" height="1"/>
<color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="dNM-XE-6RY"/>
</constraints>
</view>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="短信验证码" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="nCj-Hg-8pQ">
<rect key="frame" x="43" y="193" width="289" height="40"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="ioe-Op-8gQ"/>
</constraints>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="rno-VM-u1V">
<rect key="frame" x="43" y="241" width="289" height="1"/>
<color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="2Xf-HW-K8d"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="rm0-UH-T6r">
<rect key="frame" x="43" y="305" width="289" height="1"/>
<color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="eFI-tx-VRV"/>
</constraints>
</view>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="输入新的登录密码" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="MHD-nb-UXj">
<rect key="frame" x="43" y="257" width="289" height="40"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="W7U-Rm-Rvm"/>
</constraints>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Dv2-ja-F8y">
<rect key="frame" x="238" y="189" width="94" height="48"/>
<constraints>
<constraint firstAttribute="width" constant="94" id="FpG-3G-Wne"/>
<constraint firstAttribute="height" constant="48" id="LDX-cC-LYa"/>
</constraints>
<fontDescription key="fontDescription" type="boldSystem" pointSize="16"/>
<state key="normal" title="发送验证码">
<color key="titleColor" white="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</state>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="w3j-WU-gmW">
<rect key="frame" x="43" y="363" width="289" height="44"/>
<color key="backgroundColor" red="0.19801172859999999" green="0.55107868019999995" blue="0.17657151269999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="44" id="rMD-6U-hj0"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<state key="normal" title="确 认">
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</state>
</button>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="nCj-Hg-8pQ" firstAttribute="top" secondItem="eTv-jk-ONL" secondAttribute="bottom" constant="27" id="7Rp-Jb-dMt"/>
<constraint firstItem="nCj-Hg-8pQ" firstAttribute="width" secondItem="gY9-PP-yev" secondAttribute="width" id="Bq0-5q-qAM"/>
<constraint firstItem="rno-VM-u1V" firstAttribute="width" secondItem="nCj-Hg-8pQ" secondAttribute="width" id="CMx-ZE-SCl"/>
<constraint firstItem="Dv2-ja-F8y" firstAttribute="trailing" secondItem="nCj-Hg-8pQ" secondAttribute="trailing" id="ELP-ab-bxy"/>
<constraint firstItem="eTv-jk-ONL" firstAttribute="width" secondItem="gY9-PP-yev" secondAttribute="width" id="FJo-eR-4IW"/>
<constraint firstItem="nCj-Hg-8pQ" firstAttribute="centerX" secondItem="Q5M-cg-NOt" secondAttribute="centerX" id="Ip3-fu-Ab5"/>
<constraint firstItem="rno-VM-u1V" firstAttribute="top" secondItem="nCj-Hg-8pQ" secondAttribute="bottom" constant="8" id="JT0-3X-s12"/>
<constraint firstItem="rm0-UH-T6r" firstAttribute="top" secondItem="MHD-nb-UXj" secondAttribute="bottom" constant="8" id="Lab-21-Am5"/>
<constraint firstItem="gY9-PP-yev" firstAttribute="top" secondItem="Q5M-cg-NOt" secondAttribute="top" constant="97" id="N5z-r9-plE"/>
<constraint firstItem="eTv-jk-ONL" firstAttribute="top" secondItem="gY9-PP-yev" secondAttribute="bottom" constant="8" id="Pyp-bG-ANr"/>
<constraint firstItem="MHD-nb-UXj" firstAttribute="top" secondItem="rno-VM-u1V" secondAttribute="bottom" constant="15" id="Upp-s9-MAJ"/>
<constraint firstItem="MHD-nb-UXj" firstAttribute="width" secondItem="nCj-Hg-8pQ" secondAttribute="width" id="Z1W-dz-bRy"/>
<constraint firstItem="gY9-PP-yev" firstAttribute="leading" secondItem="Q5M-cg-NOt" secondAttribute="leading" constant="43" id="bPv-7M-n3u"/>
<constraint firstItem="rno-VM-u1V" firstAttribute="centerX" secondItem="Q5M-cg-NOt" secondAttribute="centerX" id="bu8-ma-nFV"/>
<constraint firstItem="rm0-UH-T6r" firstAttribute="centerX" secondItem="Q5M-cg-NOt" secondAttribute="centerX" id="ciw-0d-uLr"/>
<constraint firstItem="rm0-UH-T6r" firstAttribute="width" secondItem="MHD-nb-UXj" secondAttribute="width" id="cjR-SV-mNL"/>
<constraint firstItem="w3j-WU-gmW" firstAttribute="width" secondItem="MHD-nb-UXj" secondAttribute="width" id="f9d-va-eRT"/>
<constraint firstItem="w3j-WU-gmW" firstAttribute="top" secondItem="rm0-UH-T6r" secondAttribute="bottom" constant="57" id="hD7-Dt-DAs"/>
<constraint firstItem="eTv-jk-ONL" firstAttribute="centerX" secondItem="Q5M-cg-NOt" secondAttribute="centerX" id="j3f-mJ-dgC"/>
<constraint firstItem="gY9-PP-yev" firstAttribute="centerX" secondItem="Q5M-cg-NOt" secondAttribute="centerX" id="nQx-N0-rE4"/>
<constraint firstItem="w3j-WU-gmW" firstAttribute="centerX" secondItem="Q5M-cg-NOt" secondAttribute="centerX" id="oDc-Cu-4pY"/>
<constraint firstItem="Dv2-ja-F8y" firstAttribute="centerY" secondItem="nCj-Hg-8pQ" secondAttribute="centerY" id="oxc-Vq-ekG"/>
<constraint firstItem="MHD-nb-UXj" firstAttribute="centerX" secondItem="Q5M-cg-NOt" secondAttribute="centerX" id="sag-zh-3M2"/>
</constraints>
<viewLayoutGuide key="safeArea" id="Q5M-cg-NOt"/>
<point key="canvasLocation" x="33.5" y="53.5"/>
</view>
</objects>
</document>
@@ -0,0 +1,13 @@
//
// GiGaAppGaurdVC.h
// GIGA
//
// Created by lianxiang on 2018/8/21.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface GiGaAppGaurdVC : UIViewController
@end
@@ -0,0 +1,71 @@
//
// GiGaAppGaurdVC.m
// GIGA
//
// Created by lianxiang on 2018/8/21.
// Copyright © 2018 com.giga.ios. All rights reserved.
//
#import "GiGaAppGaurdVC.h"
#import "Masonry.h"
#import "GiGaUserDefault.h"
@interface GiGaAppGaurdVC ()
@end
@implementation GiGaAppGaurdVC
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
self.view.backgroundColor = [UIColor lightGrayColor];
[GiGaUserDefault saveAppGaurdflag:YES];
[self creatUI];
}
-(void)creatUI{
UIButton *dismisBtn= [UIButton buttonWithType:UIButtonTypeCustom];
[dismisBtn setTitle:@"立即体验" forState:UIControlStateNormal];
dismisBtn.backgroundColor = [UIColor greenColor];
[dismisBtn addTarget:self action:@selector(dismisBtnAction) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:dismisBtn];
[dismisBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(200);
make.height.mas_equalTo(30);
make.centerX.mas_equalTo(self.view.mas_centerX);
make.top.mas_equalTo(self.view.mas_top).offset(200);
}];
dismisBtn.layer.masksToBounds = YES;
dismisBtn.layer.cornerRadius = 15;
}
-(void)dismisBtnAction{
[self dismissViewControllerAnimated:YES completion:^{
NC_POST_NAME_OBJECT(APP_GUARD_DISSMISS, nil);
}];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
@@ -0,0 +1,13 @@
//
// GiGaMaskTaskViewController.h
// GIGA
//
// Created by lianxiang on 2018/8/14.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface GiGaMaskTaskViewController : UIViewController
@end
@@ -0,0 +1,170 @@
//
// GiGaMaskTaskViewController.m
// GIGA
//
// Created by lianxiang on 2018/8/14.
// Copyright © 2018 com.giga.ios. All rights reserved.
//
#import "GiGaMaskTaskViewController.h"
#import "MaskViewBootomWaringView.h"
#import "GiGaUserLoginVC.h"
#import "UserGuardViewController.h"
#import "GiGaUserDefault.h"
#import "GiGaAppGaurdVC.h"
@interface GiGaMaskTaskViewController ()
@property(nonatomic,strong)MaskViewBootomWaringView *waringView;
@end
@implementation GiGaMaskTaskViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
[self setUpNav];
[self addNotify];
BOOL canshowGaurd = [GiGaUserDefault isShowedGaurd];
if (!canshowGaurd) {
NSLog(@"%d",(int)canshowGaurd );
}
// NSLog(@"%d",(int)canshowGaurd );
}
-(void)viewDidAppear:(BOOL)animated{
[super viewDidAppear:animated];
BOOL showAppGaurd = [GiGaUserDefault isShowedAppGaurd];
if (!showAppGaurd) {
[self showAPPappGaurdView];
}
}
-(void)addNotify{
NC_ADD_TARGET_NAME_OBJECT(self, @selector(guardViewDissmiss), USER_GUARD_DISSMISS, nil) ;
NC_ADD_TARGET_NAME_OBJECT(self, @selector(appGauardViewDissmiss),APP_GUARD_DISSMISS, nil) ;
}
#pragma mark 新手引导消失
-(void)guardViewDissmiss{
[self showWaringView];
}
#pragma mark app引导页消失
-(void)appGauardViewDissmiss{
//
BOOL isshowGaurd = [GiGaUserDefault isShowedGaurd];
if (!isshowGaurd) {
NSLog(@"%d",(int)isshowGaurd );
[self showUserGaurdView];
}
}
-(void)dealloc{
NC_REMOVE_NAME(self, USER_GUARD_DISSMISS, nil);
NC_REMOVE_NAME(self, APP_GUARD_DISSMISS, nil);
}
#pragma mark 新手引导
-(void)showUserGaurdView{
UserGuardViewController *userGuardVC = [[UserGuardViewController alloc] init];
if (ISIOS8) {
userGuardVC.modalPresentationStyle = UIModalPresentationOverCurrentContext;
}else{
userGuardVC.modalPresentationStyle = UIModalPresentationCurrentContext;
}
userGuardVC.view.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
[self presentViewController:userGuardVC animated:NO completion:nil];
}
#pragma mark App引导页
-(void)showAPPappGaurdView{
GiGaAppGaurdVC *gaurdVC = [[GiGaAppGaurdVC alloc] init];
[self presentViewController:gaurdVC animated:YES completion:nil];
}
#pragma mark - setUpNav
-(void)setUpNav{
//leftItem
UIButton *leftBtn = [UIButton buttonWithType:UIButtonTypeCustom];
leftBtn.frame = CGRectMake(0, 0, 40, 40);
leftBtn.backgroundColor = [UIColor redColor];
[leftBtn setImage:[UIImage imageNamed:@""] forState:UIControlStateNormal];
[leftBtn addTarget:self action:@selector(leftBtnAction) forControlEvents:UIControlEventTouchUpInside];
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:leftBtn];
//rightItem
UIButton *rightBtn = [UIButton buttonWithType:UIButtonTypeCustom];
rightBtn.frame = CGRectMake(0, 0, 40, 40);
rightBtn.backgroundColor = [UIColor blueColor];
[rightBtn setImage:[UIImage imageNamed:@""] forState:UIControlStateNormal];
[rightBtn addTarget:self action:@selector(rightBtnAction) forControlEvents:UIControlEventTouchUpInside];
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:rightBtn];
}
#pragma mark 消息 action
-(void)leftBtnAction{
GiGaUserLoginVC *userlogInVC= [[GiGaUserLoginVC alloc] init];
GiGaBaseNavViewController *baseNav = [[GiGaBaseNavViewController alloc] initWithRootViewController:userlogInVC];
[self presentViewController:baseNav animated:YES completion:nil];
}
#pragma mark 个人中心 action
-(void)rightBtnAction{
}
#pragma mark -bottomView
-(void)showWaringView{
[UIView animateWithDuration:0.4 animations:^{
self.waringView.frame = CGRectMake(0,self.view.frame.size.height - 60, self.view.frame.size.width, 60);
}];
[self.view addSubview:self.waringView];
weakify(self);
[self.waringView.dismissBtn initWithBlock:^(UIButton *btn) {
NSLog(@"GIGAdismissBtn");
[UIView animateWithDuration:0.4 animations:^{
weakSelf.waringView.frame = CGRectMake(0, self.view.frame.size.height, self.view.frame.size.height, 60);
} completion:^(BOOL finished) {
[weakSelf.waringView removeFromSuperview];
}];
} for:UIControlEventTouchUpInside ];
}
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
[self showWaringView];
}
- (MaskViewBootomWaringView *)waringView{
if (!_waringView) {
self.waringView = [[MaskViewBootomWaringView alloc] initWithFrame: CGRectMake(0, self.view.frame.size.height, self.view.frame.size.height, 60)];
}
return _waringView;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
@@ -0,0 +1,14 @@
//
// UserGuardViewController.h
// GIGA
//
// Created by lianxiang on 2018/8/21.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UserGuardViewController : UIViewController
@end
@@ -0,0 +1,70 @@
//
// UserGuardViewController.m
// GIGA
//
// Created by lianxiang on 2018/8/21.
// Copyright © 2018 com.giga.ios. All rights reserved.
//
#import "UserGuardViewController.h"
#import "Masonry.h"
#import "GiGaUserDefault.h"
@interface UserGuardViewController ()
@end
@implementation UserGuardViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
//self.view.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
[self creatUI];
}
-(void)creatUI{
UIButton *dismisBtn= [UIButton buttonWithType:UIButtonTypeCustom];
[dismisBtn setTitle:@"知道了" forState:UIControlStateNormal];
[dismisBtn setTintColor:[UIColor whiteColor]];
dismisBtn.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
[dismisBtn addTarget:self action:@selector(dismisBtnAction) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:dismisBtn];
[dismisBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(100);
make.height.mas_equalTo(60);
make.centerX.mas_equalTo(self.view.mas_centerX);
make.top.mas_equalTo(self.view.mas_top).offset(200);
}];
}
-(void)dismisBtnAction{
[GiGaUserDefault saveUsergaurdflag:YES];
[self dismissViewControllerAnimated:NO completion:^{
NC_POST_NAME_OBJECT(USER_GUARD_DISSMISS, nil);
}];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
@@ -0,0 +1,15 @@
//
// MaskViewBootomWaringView.h
// GIGA
//
// Created by lianxiang on 2018/8/20.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "GiGaBlockButton.h"
@interface MaskViewBootomWaringView : UIView
@property(nonatomic,strong) GiGaBlockButton *dismissBtn;
@end
@@ -0,0 +1,65 @@
//
// MaskViewBootomWaringView.m
// GIGA
//
// Created by lianxiang on 2018/8/20.
// Copyright © 2018 com.giga.ios. All rights reserved.
//
#import "MaskViewBootomWaringView.h"
#import "Masonry.h"
@implementation MaskViewBootomWaringView
-(instancetype)initWithFrame:(CGRect)frame{
self = [super initWithFrame:frame];
if (self) {
self.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.8];
[self setUpUI];
}
return self;
}
-(void)setUpUI{
UIImageView *iconImg = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@""]];
iconImg.backgroundColor = [UIColor redColor];
[self addSubview:iconImg];
[iconImg mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.and.height.mas_equalTo(40);
make.left.mas_equalTo(10);
make.centerY.mas_equalTo(self.mas_centerY);
}];
UILabel *waringLabel = [[UILabel alloc] init];
waringLabel.text = @"亲爱滴,请您务必要开启手机声音哦";
waringLabel.textColor = [UIColor whiteColor];
waringLabel.textAlignment = NSTextAlignmentCenter;
waringLabel.font = [UIFont systemFontOfSize:16];
[waringLabel sizeToFit];
[self addSubview:waringLabel];
[waringLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(iconImg.mas_right).offset(10);
make.centerY.mas_equalTo(self.mas_centerY);
}];
GiGaBlockButton *dismisBtn = [GiGaBlockButton buttonWithType:UIButtonTypeCustom];
[dismisBtn setImage:[UIImage imageNamed:@"maske_dismiss_waring"] forState:UIControlStateNormal];
[dismisBtn setContentMode:UIViewContentModeScaleAspectFill];
self.dismissBtn = dismisBtn;
[self addSubview:dismisBtn];
[dismisBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(self.mas_right).offset(10);
make.centerY.mas_equalTo(self.mas_centerY);
make.width.and.height.mas_equalTo(40);
}];
}
@end
@@ -0,0 +1,13 @@
//
// GiGaUserViewController.h
// GIGA
//
// Created by lianxiang on 2018/8/13.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface GiGaUserViewController : UIViewController
@end
@@ -0,0 +1,37 @@
//
// GiGaUserViewController.m
// GIGA
//
// Created by lianxiang on 2018/8/13.
// Copyright © 2018 com.giga.ios. All rights reserved.
//
#import "GiGaUserViewController.h"
@interface GiGaUserViewController ()
@end
@implementation GiGaUserViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
+18
View File
@@ -0,0 +1,18 @@
//
// GiGaUser.h
// GIGA
//
// Created by lianxiang on 2018/8/15.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import "JSONModel.h"
@interface GiGaUser : JSONModel
@property(nonatomic,copy) NSString *userId;
@property(nonatomic,copy) NSString *name;
@property(nonatomic,copy) NSString *avatar;
@property(nonatomic,copy) NSString *tel;
@end
+13
View File
@@ -0,0 +1,13 @@
//
// GiGaUser.m
// GIGA
//
// Created by lianxiang on 2018/8/15.
// Copyright © 2018 com.giga.ios. All rights reserved.
//
#import "GiGaUser.h"
@implementation GiGaUser
@end
+4 -1
View File
@@ -7,7 +7,7 @@
//
#import "ViewController.h"
#import "AppDelegate.h"
@interface ViewController ()
@end
@@ -16,6 +16,9 @@
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}