初始化代码

This commit is contained in:
wushenghua
2017-01-13 22:56:39 +08:00
parent a86bfa3890
commit f102e39b61
43 changed files with 1725 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
//
// KPNavigationView+hook.h
// TestKeplerDemo
//
// Created by xmfish on 17/1/5.
// Copyright © 2017年 jd. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface KPNavigationView : UIView
@end
@interface KPNavigationView (hook)
@end
+39
View File
@@ -0,0 +1,39 @@
//
// KPNavigationView+hook.m
// TestKeplerDemo
//
// Created by xmfish on 17/1/5.
// Copyright © 2017年 jd. All rights reserved.
//
#import "KPNavigationView+hook.h"
#import <objc/runtime.h>
@implementation KPNavigationView (hook)
+ (void)load
{
Method ori_Method = class_getInstanceMethod([KPNavigationView class], @selector(layoutSubviews));
Method my_Method = class_getInstanceMethod([KPNavigationView class], @selector(ash_layoutSubviews));
method_exchangeImplementations(ori_Method, my_Method);
}
- (void)ash_layoutSubviews
{
[self ash_layoutSubviews];
UILabel* title = [self valueForKey:@"_titleLabel"];
title.text = @"哇哈哈";
UIButton* rightButton = [self valueForKey:@"_rightButton"];
[rightButton setTitle:@"分享" forState:UIControlStateNormal];
UIButton* dotButton = [self valueForKey:@"_dotButton"];
dotButton.hidden = YES;
}
@end
+17
View File
@@ -0,0 +1,17 @@
//
// KPWebViewController+hook.h
// TestKeplerDemo
//
// Created by xmfish on 17/1/5.
// Copyright © 2017年 jd. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface KPWebViewController : UIViewController
@end
@interface KPWebViewController (hook)
@end
+32
View File
@@ -0,0 +1,32 @@
//
// KPWebViewController+hook.m
// TestKeplerDemo
//
// Created by xmfish on 17/1/5.
// Copyright © 2017年 jd. All rights reserved.
//
#import "KPWebViewController+hook.h"
#import <objc/runtime.h>
@implementation KPWebViewController (hook)
+ (void)load
{
Method ori_Method = class_getInstanceMethod([KPWebViewController class], @selector(viewWillAppear:));
Method my_Method = class_getInstanceMethod([KPWebViewController class], @selector(ash_viewWillAppear:));
method_exchangeImplementations(ori_Method, my_Method);
}
- (void)ash_viewWillAppear:(BOOL)animal
{
[self ash_viewWillAppear:animal];
UIView* navigationview = [[self valueForKey:@"_kpView"] valueForKey:@"_navigationView"];
navigationview.hidden = YES;
UINavigationController* nav = self.navigationController;
nav.navigationBar.hidden = NO;
[nav setNavigationBarHidden:NO];
}
@end
+383
View File
@@ -0,0 +1,383 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
6CB1E3C71C4FB81A001937AE /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 6CB1E3C61C4FB81A001937AE /* main.m */; };
6CB1E3CA1C4FB81A001937AE /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6CB1E3C91C4FB81A001937AE /* AppDelegate.m */; };
6CB1E3CD1C4FB81A001937AE /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6CB1E3CC1C4FB81A001937AE /* ViewController.m */; };
6CB1E3D21C4FB81A001937AE /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6CB1E3D11C4FB81A001937AE /* Assets.xcassets */; };
6CB1E3D51C4FB81A001937AE /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6CB1E3D31C4FB81A001937AE /* LaunchScreen.storyboard */; };
6CB1E3DE1C4FB85D001937AE /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6CB1E3DD1C4FB85D001937AE /* Default-568h@2x.png */; };
6CB1E3E01C4FB86F001937AE /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 6CB1E3DF1C4FB86F001937AE /* libz.tbd */; };
6CB1E3E21C4FB878001937AE /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6CB1E3E11C4FB878001937AE /* SystemConfiguration.framework */; };
6CB1E3E41C4FB87F001937AE /* libsqlite3.0.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 6CB1E3E31C4FB87F001937AE /* libsqlite3.0.tbd */; };
6CB1E3E81C4FB891001937AE /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6CB1E3E71C4FB891001937AE /* Foundation.framework */; };
6CB1E3EA1C4FB898001937AE /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6CB1E3E91C4FB898001937AE /* UIKit.framework */; };
A99DE8A51E1DDD2C0042A54B /* KPNavigationView+hook.m in Sources */ = {isa = PBXBuildFile; fileRef = A99DE8A41E1DDD2C0042A54B /* KPNavigationView+hook.m */; };
A99DE8A81E1DE8A70042A54B /* KPWebViewController+hook.m in Sources */ = {isa = PBXBuildFile; fileRef = A99DE8A71E1DE8A70042A54B /* KPWebViewController+hook.m */; };
EE0105FD1C8418CD000B6706 /* JDKeplerSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EE0105FC1C8418CD000B6706 /* JDKeplerSDK.framework */; };
EED9C2B21C622BAC00B5240E /* Kepler.bundle in Resources */ = {isa = PBXBuildFile; fileRef = EED9C2B11C622BAC00B5240E /* Kepler.bundle */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
6CB1E3C21C4FB81A001937AE /* TestKeplerDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TestKeplerDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
6CB1E3C61C4FB81A001937AE /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
6CB1E3C81C4FB81A001937AE /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
6CB1E3C91C4FB81A001937AE /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
6CB1E3CB1C4FB81A001937AE /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; };
6CB1E3CC1C4FB81A001937AE /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; };
6CB1E3D11C4FB81A001937AE /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
6CB1E3D41C4FB81A001937AE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
6CB1E3D61C4FB81A001937AE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
6CB1E3DD1C4FB85D001937AE /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = "<group>"; };
6CB1E3DF1C4FB86F001937AE /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; };
6CB1E3E11C4FB878001937AE /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; };
6CB1E3E31C4FB87F001937AE /* libsqlite3.0.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libsqlite3.0.tbd; path = usr/lib/libsqlite3.0.tbd; sourceTree = SDKROOT; };
6CB1E3E71C4FB891001937AE /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
6CB1E3E91C4FB898001937AE /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
A99DE8A31E1DDD2C0042A54B /* KPNavigationView+hook.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "KPNavigationView+hook.h"; sourceTree = "<group>"; };
A99DE8A41E1DDD2C0042A54B /* KPNavigationView+hook.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "KPNavigationView+hook.m"; sourceTree = "<group>"; };
A99DE8A61E1DE8A70042A54B /* KPWebViewController+hook.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "KPWebViewController+hook.h"; sourceTree = "<group>"; };
A99DE8A71E1DE8A70042A54B /* KPWebViewController+hook.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "KPWebViewController+hook.m"; sourceTree = "<group>"; };
EE0105FC1C8418CD000B6706 /* JDKeplerSDK.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = JDKeplerSDK.framework; sourceTree = "<group>"; };
EED9C2B11C622BAC00B5240E /* Kepler.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = Kepler.bundle; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
6CB1E3BF1C4FB81A001937AE /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
6CB1E3EA1C4FB898001937AE /* UIKit.framework in Frameworks */,
EE0105FD1C8418CD000B6706 /* JDKeplerSDK.framework in Frameworks */,
6CB1E3E81C4FB891001937AE /* Foundation.framework in Frameworks */,
6CB1E3E41C4FB87F001937AE /* libsqlite3.0.tbd in Frameworks */,
6CB1E3E21C4FB878001937AE /* SystemConfiguration.framework in Frameworks */,
6CB1E3E01C4FB86F001937AE /* libz.tbd in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
6CB1E3B91C4FB81A001937AE = {
isa = PBXGroup;
children = (
A99DE8A61E1DE8A70042A54B /* KPWebViewController+hook.h */,
A99DE8A71E1DE8A70042A54B /* KPWebViewController+hook.m */,
A99DE8A31E1DDD2C0042A54B /* KPNavigationView+hook.h */,
A99DE8A41E1DDD2C0042A54B /* KPNavigationView+hook.m */,
6CB1E3E91C4FB898001937AE /* UIKit.framework */,
6CB1E3E71C4FB891001937AE /* Foundation.framework */,
6CB1E3E11C4FB878001937AE /* SystemConfiguration.framework */,
6CB1E3E31C4FB87F001937AE /* libsqlite3.0.tbd */,
6CB1E3DF1C4FB86F001937AE /* libz.tbd */,
6CB1E3C41C4FB81A001937AE /* TestKeplerDemo */,
6CB1E3C31C4FB81A001937AE /* Products */,
);
sourceTree = "<group>";
};
6CB1E3C31C4FB81A001937AE /* Products */ = {
isa = PBXGroup;
children = (
6CB1E3C21C4FB81A001937AE /* TestKeplerDemo.app */,
);
name = Products;
sourceTree = "<group>";
};
6CB1E3C41C4FB81A001937AE /* TestKeplerDemo */ = {
isa = PBXGroup;
children = (
EE0105FC1C8418CD000B6706 /* JDKeplerSDK.framework */,
EED9C2B11C622BAC00B5240E /* Kepler.bundle */,
6CB1E3C81C4FB81A001937AE /* AppDelegate.h */,
6CB1E3C91C4FB81A001937AE /* AppDelegate.m */,
6CB1E3CB1C4FB81A001937AE /* ViewController.h */,
6CB1E3CC1C4FB81A001937AE /* ViewController.m */,
6CB1E3D11C4FB81A001937AE /* Assets.xcassets */,
6CB1E3D31C4FB81A001937AE /* LaunchScreen.storyboard */,
6CB1E3D61C4FB81A001937AE /* Info.plist */,
6CB1E3C51C4FB81A001937AE /* Supporting Files */,
);
path = TestKeplerDemo;
sourceTree = "<group>";
};
6CB1E3C51C4FB81A001937AE /* Supporting Files */ = {
isa = PBXGroup;
children = (
6CB1E3DD1C4FB85D001937AE /* Default-568h@2x.png */,
6CB1E3C61C4FB81A001937AE /* main.m */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
6CB1E3C11C4FB81A001937AE /* TestKeplerDemo */ = {
isa = PBXNativeTarget;
buildConfigurationList = 6CB1E3D91C4FB81A001937AE /* Build configuration list for PBXNativeTarget "TestKeplerDemo" */;
buildPhases = (
6CB1E3BE1C4FB81A001937AE /* Sources */,
6CB1E3BF1C4FB81A001937AE /* Frameworks */,
6CB1E3C01C4FB81A001937AE /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = TestKeplerDemo;
productName = TestKeplerDemo;
productReference = 6CB1E3C21C4FB81A001937AE /* TestKeplerDemo.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
6CB1E3BA1C4FB81A001937AE /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0730;
ORGANIZATIONNAME = jd;
TargetAttributes = {
6CB1E3C11C4FB81A001937AE = {
CreatedOnToolsVersion = 7.2;
ProvisioningStyle = Manual;
SystemCapabilities = {
com.apple.BackgroundModes = {
enabled = 1;
};
};
};
};
};
buildConfigurationList = 6CB1E3BD1C4FB81A001937AE /* Build configuration list for PBXProject "TestKeplerDemo" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 6CB1E3B91C4FB81A001937AE;
productRefGroup = 6CB1E3C31C4FB81A001937AE /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
6CB1E3C11C4FB81A001937AE /* TestKeplerDemo */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
6CB1E3C01C4FB81A001937AE /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
EED9C2B21C622BAC00B5240E /* Kepler.bundle in Resources */,
6CB1E3D51C4FB81A001937AE /* LaunchScreen.storyboard in Resources */,
6CB1E3D21C4FB81A001937AE /* Assets.xcassets in Resources */,
6CB1E3DE1C4FB85D001937AE /* Default-568h@2x.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
6CB1E3BE1C4FB81A001937AE /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
A99DE8A51E1DDD2C0042A54B /* KPNavigationView+hook.m in Sources */,
6CB1E3CD1C4FB81A001937AE /* ViewController.m in Sources */,
6CB1E3CA1C4FB81A001937AE /* AppDelegate.m in Sources */,
A99DE8A81E1DE8A70042A54B /* KPWebViewController+hook.m in Sources */,
6CB1E3C71C4FB81A001937AE /* main.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
6CB1E3D31C4FB81A001937AE /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
6CB1E3D41C4FB81A001937AE /* Base */,
);
name = LaunchScreen.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
6CB1E3D71C4FB81A001937AE /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution: Beijing Jingdong Century Trading Co., Ltd.";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_BITCODE = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
PROVISIONING_PROFILE = "0a225d6b-6c77-4737-9c34-069cf0a8c913";
SDKROOT = iphoneos;
};
name = Debug;
};
6CB1E3D81C4FB81A001937AE /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_BITCODE = NO;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
MTL_ENABLE_DEBUG_INFO = NO;
ONLY_ACTIVE_ARCH = NO;
PROVISIONING_PROFILE = "0a225d6b-6c77-4737-9c34-069cf0a8c913";
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
};
name = Release;
};
6CB1E3DA1C4FB81A001937AE /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Distribution: Xiamen Linggan Fangzhou Information Technology Co., Ltd";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution: Xiamen Linggan Fangzhou Information Technology Co., Ltd";
DEVELOPMENT_TEAM = "";
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/TestKeplerDemo",
);
INFOPLIST_FILE = TestKeplerDemo/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/TestKeplerDemo",
);
ONLY_ACTIVE_ARCH = NO;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_BUNDLE_IDENTIFIER = com.jd.KeplerApp;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "ccd12fb7-191c-48e6-9d1d-afad43feae6d";
PROVISIONING_PROFILE_SPECIFIER = "企业inhouse通用";
};
name = Debug;
};
6CB1E3DB1C4FB81A001937AE /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Distribution: Xiamen Linggan Fangzhou Information Technology Co., Ltd";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution: Xiamen Linggan Fangzhou Information Technology Co., Ltd";
DEVELOPMENT_TEAM = "";
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/TestKeplerDemo",
);
INFOPLIST_FILE = TestKeplerDemo/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/TestKeplerDemo",
);
ONLY_ACTIVE_ARCH = NO;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_BUNDLE_IDENTIFIER = com.jd.KeplerApp;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "ccd12fb7-191c-48e6-9d1d-afad43feae6d";
PROVISIONING_PROFILE_SPECIFIER = "企业inhouse通用";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
6CB1E3BD1C4FB81A001937AE /* Build configuration list for PBXProject "TestKeplerDemo" */ = {
isa = XCConfigurationList;
buildConfigurations = (
6CB1E3D71C4FB81A001937AE /* Debug */,
6CB1E3D81C4FB81A001937AE /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
6CB1E3D91C4FB81A001937AE /* Build configuration list for PBXNativeTarget "TestKeplerDemo" */ = {
isa = XCConfigurationList;
buildConfigurations = (
6CB1E3DA1C4FB81A001937AE /* Debug */,
6CB1E3DB1C4FB81A001937AE /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 6CB1E3BA1C4FB81A001937AE /* Project object */;
}
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:TestKeplerDemo.xcodeproj">
</FileRef>
</Workspace>
@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0810"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6CB1E3C11C4FB81A001937AE"
BuildableName = "TestKeplerDemo.app"
BlueprintName = "TestKeplerDemo"
ReferencedContainer = "container:TestKeplerDemo.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6CB1E3C11C4FB81A001937AE"
BuildableName = "TestKeplerDemo.app"
BlueprintName = "TestKeplerDemo"
ReferencedContainer = "container:TestKeplerDemo.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6CB1E3C11C4FB81A001937AE"
BuildableName = "TestKeplerDemo.app"
BlueprintName = "TestKeplerDemo"
ReferencedContainer = "container:TestKeplerDemo.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6CB1E3C11C4FB81A001937AE"
BuildableName = "TestKeplerDemo.app"
BlueprintName = "TestKeplerDemo"
ReferencedContainer = "container:TestKeplerDemo.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>TestKeplerDemo.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>6CB1E3C11C4FB81A001937AE</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>
@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0710"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6CB1E3C11C4FB81A001937AE"
BuildableName = "TestKeplerDemo.app"
BlueprintName = "TestKeplerDemo"
ReferencedContainer = "container:TestKeplerDemo.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6CB1E3C11C4FB81A001937AE"
BuildableName = "TestKeplerDemo.app"
BlueprintName = "TestKeplerDemo"
ReferencedContainer = "container:TestKeplerDemo.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6CB1E3C11C4FB81A001937AE"
BuildableName = "TestKeplerDemo.app"
BlueprintName = "TestKeplerDemo"
ReferencedContainer = "container:TestKeplerDemo.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6CB1E3C11C4FB81A001937AE"
BuildableName = "TestKeplerDemo.app"
BlueprintName = "TestKeplerDemo"
ReferencedContainer = "container:TestKeplerDemo.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>TestKeplerDemo.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>6CB1E3C11C4FB81A001937AE</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>
@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0720"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6CB1E3C11C4FB81A001937AE"
BuildableName = "TestKeplerDemo.app"
BlueprintName = "TestKeplerDemo"
ReferencedContainer = "container:TestKeplerDemo.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6CB1E3C11C4FB81A001937AE"
BuildableName = "TestKeplerDemo.app"
BlueprintName = "TestKeplerDemo"
ReferencedContainer = "container:TestKeplerDemo.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6CB1E3C11C4FB81A001937AE"
BuildableName = "TestKeplerDemo.app"
BlueprintName = "TestKeplerDemo"
ReferencedContainer = "container:TestKeplerDemo.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6CB1E3C11C4FB81A001937AE"
BuildableName = "TestKeplerDemo.app"
BlueprintName = "TestKeplerDemo"
ReferencedContainer = "container:TestKeplerDemo.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>TestKeplerDemo.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>6CB1E3C11C4FB81A001937AE</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
type = "1"
version = "2.0">
</Bucket>
@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0820"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6CB1E3C11C4FB81A001937AE"
BuildableName = "TestKeplerDemo.app"
BlueprintName = "TestKeplerDemo"
ReferencedContainer = "container:TestKeplerDemo.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6CB1E3C11C4FB81A001937AE"
BuildableName = "TestKeplerDemo.app"
BlueprintName = "TestKeplerDemo"
ReferencedContainer = "container:TestKeplerDemo.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6CB1E3C11C4FB81A001937AE"
BuildableName = "TestKeplerDemo.app"
BlueprintName = "TestKeplerDemo"
ReferencedContainer = "container:TestKeplerDemo.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6CB1E3C11C4FB81A001937AE"
BuildableName = "TestKeplerDemo.app"
BlueprintName = "TestKeplerDemo"
ReferencedContainer = "container:TestKeplerDemo.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>TestKeplerDemo.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>6CB1E3C11C4FB81A001937AE</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>
+17
View File
@@ -0,0 +1,17 @@
//
// AppDelegate.h
// TestKeplerDemo
//
// Created by Lemon on 16/1/20.
// Copyright © 2016年 jd. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
+86
View File
@@ -0,0 +1,86 @@
//
// AppDelegate.m
// TestKeplerDemo
//
// Created by Lemon on 16/1/20.
// Copyright © 2016年 jd. All rights reserved.
//
#import "AppDelegate.h"
#import "ViewController.h"
#import <JDKeplerSDK/KeplerApiManager.h>
#define Value_AppKey @"7DA9CEF6540029AA95E09135D3AB4AED"
#define Value_AppSecret @"e74f246c3bee44b5b968a5326614f402"
@interface AppDelegate ()
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
[[KeplerApiManager sharedKPService]asyncInitSdk:Value_AppKey secretKey:Value_AppSecret sucessCallback:^(){
}failedCallback:^(NSError *error){
}];
_window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
ViewController *rootVC = [[ViewController alloc] init];
UINavigationController *navigation = [[UINavigationController alloc] initWithRootViewController:rootVC];
[_window setRootViewController:navigation];
[_window setBackgroundColor:[UIColor whiteColor]];
[self.window makeKeyAndVisible];
return YES;
}
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation NS_AVAILABLE_IOS(4_2){
return [[KeplerApiManager sharedKPService] handleOpenURL:url];
}
- (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 throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
- (void)applicationDidEnterBackground:(UIApplication *)application {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
- (void)applicationWillTerminate:(UIApplication *)application {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
//iOS7以后会根据获取的结果适当的调整唤醒的时间策略
- (void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
NSLog(@"%s",__FUNCTION__);
BOOL haveJDKeplerServiceNewContent = NO;
[self fetchJDKeplerService:&haveJDKeplerServiceNewContent];
if (haveJDKeplerServiceNewContent){
completionHandler(UIBackgroundFetchResultNewData);
} else {
completionHandler(UIBackgroundFetchResultNoData);
}
}
- (void)fetchJDKeplerService:(BOOL *)paramFetchedJDKeplerNewContent {
[[KeplerApiManager sharedKPService] checkJDKeplerUpdate]; //检测更新
}
@end
@@ -0,0 +1,39 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "3x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon@2x.png",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9531" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="198" y="385"/>
</scene>
</scenes>
</document>
Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

+64
View File
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>开普勒</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.2.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleURLSchemes</key>
<array>
<string>jd7DA9CEF6540029AA95E09135D3AB4AED</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.2.0</string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>jdlogin</string>
</array>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>UIBackgroundModes</key>
<array>
<string>fetch</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
</dict>
</plist>
+20
View File
@@ -0,0 +1,20 @@
//
// JDKeplerSDK.h
// JDKeplerSDK
//
// Created by JD.K on 16/3/15.
// Copyright © 2016年 JD.K. All rights reserved.
//
#import <UIKit/UIKit.h>
//! Project version number for JDKeplerSDK.
FOUNDATION_EXPORT double JDKeplerSDKVersionNumber;
//! Project version string for JDKeplerSDK.
FOUNDATION_EXPORT const unsigned char JDKeplerSDKVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <JDKeplerSDK/PublicHeader.h>
#import<JDKeplerSDK/KeplerApiManager.h>
@@ -0,0 +1,147 @@
//
// KeplerApiManager.h
// KeplerApp
// 提供Kepler服务
// Created by JD.K on 16/6/20.
// Copyright © 2016年 JD.K. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
//#define JDKepler_Deprecated(instead) NS_DEPRECATED_IOS(1_1_0, 1_2_2,instead)
/** 初始化成功回调 */
typedef void (^initSuccessCallback)();
/** 初始化失败回调 */
typedef void (^initFailedCallback)(NSError *error);
/**
* Kepler登录授权成功回调
*
* @param token 登录授权成功后返回的token
*/
typedef void (^keplerLoginSuccessCallback)(NSString *token);
/** Kepler登录授权失败回调 */
typedef void (^keplerLoginFailureCallback)(NSError *error);
@interface KeplerApiManager : NSObject{
}
/**
* KeplerApiManager 单例
*
* @return KeplerApiManager 单例
*/
+ (KeplerApiManager *)sharedKPService;
/**
* 注册Kepler 服务
*
* @param appKey 注册的appKey
* @param appSecret 注册的secretKey
*/
- (void)asyncInitSdk:(NSString *)appKey
secretKey:(NSString *)appSecret
sucessCallback:(initSuccessCallback)sucessCallback
failedCallback:(initFailedCallback)failedCallback;
/**
* 通过URL打开Kepler页面
*
* @param url 页面url
* @param sourceController 当前显示的UIViewController
* @param jumpType 跳转类型(默认 push) 1代表present 2代表push
* @param customParams 自定义订单统计参数 不需要可以传nil
*/
- (void)openKeplerPageWithURL:(NSString *)url sourceController:(UIViewController *)sourceController jumpType:(NSInteger)jumpType customParams:(NSString *)customParams;
/**
* 打开热卖页
*/
- (void)openHotSalePage:(UIViewController *)sourceController jumpType:(NSInteger)jumpType customParams:(NSString *)customParams;
/**
* 打开导航页
*/
- (void)openNavigationPage:(UIViewController *)sourceController jumpType:(NSInteger)jumpType customParams:(NSString *)customParams;
/**
* 根据传入的名称打开对应的分类列表
*/
- (void)openCategoryListWithName:(NSString *)categoryName sourceController:(UIViewController *)sourceController jumpType:(NSInteger)jumpType customParams:(NSString *)customParams;
/**
* 通过SKU打开Kepler单品页
*
* @param sku 商品SKU
*/
- (void)openItemDetailWithSKU:(NSString *)sku sourceController:(UIViewController *)sourceController jumpType:(NSInteger)jumpType customParams:(NSString *)customParams;
/**
* 打开订单列表
*/
- (void)openOrderList:(UIViewController *)sourceController jumpType:(NSInteger)jumpType customParams:(NSString *)customParams;
/**
* 根据搜索关键字打开搜索结果页
*
* @param searchKey 搜索关键字
*/
- (void)openSearchResult:(NSString *)searchKey sourceController:(UIViewController *)sourceController jumpType:(NSInteger)jumpType customParams:(NSString *)customParams;
/**
* 打开购物车界面
*
*/
- (void)openShoppingCart:(UIViewController *)sourceController jumpType:(NSInteger)jumpType customParams:(NSString *)customParams;
/**
* 添加到购物车
*
* @param skuList 添加到购物车中的商品id
* @param numList 添加到购物车中商品数量,多个商品必须与skuList一一对应
* @param success 添加成功回调
* @param failure 添加失败回调
*/
- (void)addToCartWithSkuList:(NSArray *)skuList numList:(NSArray *)numList sourceController:(UIViewController *)sourceController success:(void(^)(void))success failure:(void(^)(NSError *))failure;
/**
* 直接购买
* @param skuList 添加到购物车中的商品id
* @param numList 添加到购物车中商品数量,多个商品必须与skuList一一对应
*
*/
- (void)directBuyWithSkuList:(NSArray *)skuList numList:(NSArray *)numList sourceController:(UIViewController *)sourceController jumpType:(NSInteger)jumpType customParams:(NSString *)customParams;
/**
* Kepler处理URL
*
* @param url url
*
* @return 处理结果
*/
- (BOOL)handleOpenURL:(NSURL*)url;
/**
* 检测更新
*/
- (void)checkJDKeplerUpdate;
/**
* 取消授权
*/
- (void)cancelAuth;
/**
* 设置加载进度条颜色
*/
- (void)setKeplerProgressBarColor:(UIColor *)progressBarColor;
/**
* Kepler登录授权
*/
- (void)keplerLoginWithViewController:(UIViewController *)viewController success:(keplerLoginSuccessCallback)successCallback failure:(keplerLoginFailureCallback)failureCallback;
/**
* 标识曾经登录完成过,因为服务端安全逻辑,可能这个用户登录态已经失效
*/
- (BOOL)isKeplerLogin;
@end
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 471 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1021 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 440 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 534 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 430 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 947 B

+1
View File
@@ -0,0 +1 @@
=z¾r¼™´Eâ[-% ¾
Binary file not shown.

After

Width:  |  Height:  |  Size: 958 B

+15
View File
@@ -0,0 +1,15 @@
//
// ViewController.h
// TestKeplerDemo
//
// Created by Lemon on 16/1/20.
// Copyright © 2016年 jd. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@end
+342
View File
@@ -0,0 +1,342 @@
//
// ViewController.m
// JDKeplerDevApp
//
// Created by Lemon on 16/1/20.
// Copyright © 2016年 jd. All rights reserved.
//
#import "ViewController.h"
#import <JDKeplerSDK/KeplerApiManager.h>
@interface ViewController ()<UITextFieldDelegate,UIScrollViewDelegate>
@property (nonatomic, strong) UITextField *testField;
@property (nonatomic, strong) UITextField *textFieldSKUList;
@property (nonatomic, strong) UITextField *textFieldNumList;
@property (nonatomic, strong) UITextField *currentTextField;
@property(nonatomic, weak) UIScrollView *scrollView;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
UIScrollView *scrollView = [[UIScrollView alloc] init];
scrollView.frame = self.view.bounds;
self.scrollView = scrollView;
self.scrollView.showsHorizontalScrollIndicator = NO;
self.scrollView.showsVerticalScrollIndicator = NO;
self.scrollView.delegate = self;
[self.view addSubview:scrollView];
self.view.backgroundColor = [UIColor whiteColor];
self.navigationController.navigationBarHidden = YES;
CGFloat height = 60.0f;
self.testField = [[UITextField alloc]initWithFrame:CGRectMake(15, 30, self.view.frame.size.width-30, 30)];
self.testField.textAlignment = NSTextAlignmentLeft;
self.testField.font = [UIFont systemFontOfSize:14.0f];
self.testField.backgroundColor = [UIColor whiteColor];
self.testField.layer.borderWidth = 1.0f;
self.testField.layer.borderColor =[UIColor orangeColor].CGColor;
self.testField.placeholder = @"请输入Url/Sku编号/分类名称/搜索名 不输入使用默认值";
self.testField.layer.cornerRadius = 2.0f;
self.testField.delegate = self;
[self.scrollView addSubview:self.testField];
CGFloat left = (self.view.frame.size.width - 200)/3.0f;
CGFloat right = self.view.frame.size.width - left - 100.0f;
[self addButton:@"清除" xPos:left yPos:65 action:@selector(clearTextField)];
[self addButton:@"粘贴" xPos:right yPos:65 action:@selector(pasteToTextField)];
UIView *lineView1 = [[UIView alloc] initWithFrame:CGRectMake(0, 65+45, self.view.frame.size.width, 1)];
lineView1.backgroundColor = [UIColor blueColor];
[self.scrollView addSubview:lineView1];
[self addButton:@"商详页" xPos:right yPos:65+height*1 action:@selector(skuClick)];
[self addButton:@"URL跳转" xPos:left yPos:65+height*1 action:@selector(urlJumpClick)];
[self addButton:@"分类列表" xPos:right yPos:65+height*2 action:@selector(categoryList)];
[self addButton:@"搜索" xPos:left yPos:65+height*2 action:@selector(search)];
UIView *lineView2 = [[UIView alloc] initWithFrame:CGRectMake(0, 65+height*3+45, self.view.frame.size.width, 1)];
lineView2.backgroundColor = [UIColor blueColor];
[self.scrollView addSubview:lineView2];
[self addButton:@"导航页" xPos:left yPos:65+height*4 action:@selector(homeClick)];
[self addButton:@"热卖页" xPos:right yPos:65+height*4 action:@selector(hotClick)];
[self addButton:@"取消授权" xPos:left yPos:65+height*6 action:@selector(cancelClick)];
[self addButton:@"订单列表" xPos:left yPos:65+height*5 action:@selector(orderList)];
[self addButton:@"打开购物车" xPos:right yPos:65+height*5 action:@selector(openShoppingCart)];
[self addView:@"登录授权" yPos:65+height*7 action:@selector(loginSwitchAction:)];
UIView *lineView3 = [[UIView alloc] initWithFrame:CGRectMake(0, 65+height*7+45, self.view.frame.size.width, 1)];
lineView3.backgroundColor = [UIColor blueColor];
[self.scrollView addSubview:lineView3];
self.textFieldSKUList = [[UITextField alloc] initWithFrame:CGRectMake(15, 65+height*8, self.view.frame.size.width-30, 30)];
self.textFieldSKUList.layer.borderWidth = 1.0f;
self.textFieldSKUList.layer.borderColor = [UIColor orangeColor].CGColor;
self.textFieldSKUList.layer.cornerRadius = 2.0f;
self.textFieldSKUList.clearButtonMode = UITextFieldViewModeWhileEditing;
self.textFieldSKUList.placeholder = @"SKUList 用空格隔开 不填写使用默认值";
self.textFieldSKUList.delegate = self;
[self.scrollView addSubview:self.textFieldSKUList];
self.textFieldNumList = [[UITextField alloc] initWithFrame:CGRectMake(15, 65+height*9, self.view.frame.size.width-30, 30)];
self.textFieldNumList.layer.borderWidth = 1.0f;
self.textFieldNumList.layer.borderColor = [UIColor orangeColor].CGColor;
self.textFieldNumList.layer.cornerRadius = 2.0f;
self.textFieldNumList.clearButtonMode = UITextFieldViewModeWhileEditing;
self.textFieldNumList.placeholder = @"NumList 用空格隔开 不填写使用默认值";
self.textFieldNumList.delegate = self;
[self.scrollView addSubview:self.textFieldNumList];
[self addButton:@"加入购物车" xPos:left yPos:65+height*10 action:@selector(addToCart)];
[self addButton:@"直接购买" xPos:right yPos:65+height*10 action:@selector(directBuy)];
self.scrollView.contentSize = CGSizeMake(0, CGRectGetMaxY([self.scrollView.subviews lastObject].frame) + 50);
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
self.navigationController.navigationBar.hidden = YES;
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
}
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
- (void)viewDidDisappear:(BOOL)animated {
[super viewDidDisappear:animated];
}
- (void)addButton:(NSString *)title xPos:(CGFloat)x yPos:(CGFloat)y action:(SEL)action{
UIButton *testButton = [[UIButton alloc] initWithFrame:CGRectMake(x, y, 100, 30)];
[testButton setTitle:title forState:UIControlStateNormal];
testButton.backgroundColor = [UIColor blueColor];
testButton.showsTouchWhenHighlighted =YES;
[self.scrollView addSubview:testButton];
[testButton addTarget:self action:action forControlEvents:UIControlEventTouchUpInside];
}
- (void)addView:(NSString *)title yPos:(CGFloat)y action:(SEL)action{
UIView *containView = [[UIView alloc] initWithFrame:CGRectMake((self.view.frame.size.width-200)/2, y, 200, 30)];
containView.backgroundColor = [UIColor blueColor];
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 130, 30)];
label.text = title;
label.textColor = [UIColor whiteColor];
label.textAlignment = NSTextAlignmentCenter;
[containView addSubview:label];
UISwitch *loginSwitch = [[UISwitch alloc] initWithFrame:CGRectMake(CGRectGetMaxX(label.frame), 0, 0, 0)];
[loginSwitch addTarget:self action:action forControlEvents:UIControlEventValueChanged];
[containView addSubview:loginSwitch];
[self.scrollView addSubview:containView];
}
- (void)clearTextField
{
self.testField.text = nil;
}
- (void)pasteToTextField
{
self.testField.text = [[UIPasteboard generalPasteboard] string];
}
- (void)loginSwitchAction:(UISwitch *)loginSwitch
{
BOOL isSwitchOn = loginSwitch.isOn;
if (isSwitchOn) {
[[KeplerApiManager sharedKPService] keplerLoginWithViewController:self success:^(NSString *token) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"登录授权" message:@"登录授权成功" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
[alert show];
} failure:^(NSError *error) {
loginSwitch.on = NO;
}];
}else{
[[KeplerApiManager sharedKPService] cancelAuth];
}
}
- (void)skuClick{
NSString *sku = self.testField.text.length?self.testField.text:@"1152042";
[[KeplerApiManager sharedKPService] openItemDetailWithSKU:sku sourceController:self jumpType:2 customParams:nil];
}
- (void)hotClick{
// NSString *json = @"{\"type\": \"2\",\"blockId\":\"0\"}";
[[KeplerApiManager sharedKPService] openHotSalePage:self jumpType:2 customParams:nil];
}
- (void)homeClick{
// NSString *json = @"{\"type\": \"3\",\"blockId\":\"0\"}";
[[KeplerApiManager sharedKPService] openNavigationPage:self jumpType:2 customParams:nil];
}
- (void)cancelClick{
[[KeplerApiManager sharedKPService] cancelAuth];
}
- (void)urlJumpClick {
//修改url并且重定向
NSString *url = @"http://m.jd.com";
url = @"http://union.click.jd.com/jdc?p=AyIOZRprFQoSAlcZWCVGTV8LRGtMR1dGXgVFSR1JUkpJBUkcU0QLTh9HRwwHXRteFwARGAxeB0gMVQsQDAFBSkVEC0dXZUNTcRFFBEFaakIBR2tOX1RkHUU5XWFuVyIYC00AZFsJXidlDh43VhleHAYSB1UfaxUFFjdlfSYlVHwHVBpaFAMTBFASaxQyEgJRHV4cBBoFVBNfEjIVNwpPHkFSUFMdRR9AUkw3ZRo%3D&t=W1dCFBBFC14NXAAECUteDEYWRQ5RUFcZVRNbEAAQBEpCHklfHEBZXkxPVlpQFkUHGXJTRiNfBUpWSn8QTwc%3D&e=25840255236224";
url = @"http://baidu.com1";
NSString *text = self.testField.text;
if (text.length > 0) {
url = text;
}
// NSString *json = [NSString stringWithFormat:@"{\"type\": \"4\",\"url\":\"%@\"}",url];
[[KeplerApiManager sharedKPService] openKeplerPageWithURL:url sourceController:self jumpType:2 customParams:@"from_os=iOS"];
}
- (void)loginAuth
{
[[KeplerApiManager sharedKPService] keplerLoginWithViewController:self success:^(NSString *token) {
NSLog(@"登录授权成功");
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"登录授权" message:@"登录授权成功" delegate:nil cancelButtonTitle:@"取消" otherButtonTitles:@"OK", nil];
[alert show];
} failure:^(NSError *error) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"登录授权" message:@"登录授权失败" delegate:nil cancelButtonTitle:@"取消" otherButtonTitles:@"OK", nil];
[alert show];
}];
}
- (void)orderList
{
[[KeplerApiManager sharedKPService] openOrderList:self jumpType:1 customParams:@"统计参数"];
}
- (void)categoryList
{
NSString *categoryName = self.testField.text.length>0?self.testField.text:@"手机";
[[KeplerApiManager sharedKPService] openCategoryListWithName:categoryName sourceController:self jumpType:2 customParams:nil];
}
- (void)search
{
NSString *text = self.testField.text.length>0?self.testField.text:@"macbookPro";
[[KeplerApiManager sharedKPService] openSearchResult:text sourceController:self jumpType:2 customParams:nil];
}
- (void)addToCart
{
NSString *skuListStr = self.textFieldSKUList.text.length?self.textFieldSKUList.text:@"1152042 1564869";
NSArray *skuListArray = [skuListStr componentsSeparatedByString:@" "];
NSString *numListStr = self.textFieldNumList.text.length?self.textFieldNumList.text:@"3 10";
NSArray *numListArray = [numListStr componentsSeparatedByString:@" "];
[[KeplerApiManager sharedKPService] addToCartWithSkuList:skuListArray numList:numListArray sourceController:self success:^{
NSLog(@"添加成功");
} failure:^(NSError *error) {
NSInteger code = error.code;
switch (code) {
case 1003: //token不存在
case 1004: //token过期
case 1022: //缺少token参数
//需先调用登录授权接口,成功后再调用该添加购物车方法.
break;
case 8969: //购物车商品达到最上限
break;
case 500: //添加失败
break;
case 1005: //app_key不存在
case 1020: //缺少app_key参数
case 1021: //无效app_key
break;
case 3038: //系统错误
break;
default:
break;
}
}];
}
- (void)directBuy
{
NSString *skuListStr = self.textFieldSKUList.text.length?self.textFieldSKUList.text:@"1152042 1564869";
NSArray *skuListArray = [skuListStr componentsSeparatedByString:@" "];
NSString *numListStr = self.textFieldNumList.text.length?self.textFieldNumList.text:@"3 10";
NSArray *numListArray = [numListStr componentsSeparatedByString:@" "];
[[KeplerApiManager sharedKPService] directBuyWithSkuList:skuListArray numList:numListArray sourceController:self jumpType:2 customParams:nil];
}
- (void)openShoppingCart
{
[[KeplerApiManager sharedKPService] openShoppingCart:self jumpType:2 customParams:nil];
}
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
[self.testField resignFirstResponder];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - 键盘事件
- (void)keyboardWillShow:(NSNotification *)notification
{
CGRect keyboardFrame = [notification.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];
CGFloat height = keyboardFrame.origin.y;
CGFloat textField_maxY = CGRectGetMaxY(self.currentTextField.frame);
CGFloat space = - self.scrollView.contentOffset.y + textField_maxY;
CGFloat transformY = height - space;
if (transformY < 0) {
CGRect frame = self.view.frame;
frame.origin.y = transformY ;
self.view.frame = frame;
}
}
- (void)keyboardWillHide:(NSNotification *)notification
{
CGRect frame = self.view.frame;
frame.origin.y = 0;
self.view.frame = frame;
}
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
self.currentTextField = textField;
return YES;
}
- (void)textFieldDidEndEditing:(UITextField *)textField
{
self.currentTextField = nil;
}
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
[self.view endEditing:YES];
}
@end
+16
View File
@@ -0,0 +1,16 @@
//
// main.m
// TestKeplerDemo
//
// Created by Lemon on 16/1/20.
// Copyright © 2016年 jd. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
int main(int argc, char * argv[]) {
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}