Toggle navigation
Toggle navigation
This project
Loading...
Sign in
ios
/
YH_Explorer
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
gaoqiang xu
9 years ago
Commit
c60e43a83452bbf6fc01c22b4b3b2e753cd26248
1 parent
960fd812
添加本地机能message,接收H5发送的消息
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
139 additions
and
44 deletions
YHExplorer/CordovaPlugins/CDVYHInterface.m
YHExplorer/CordovaPlugins/CDVYHInterfaceDelegate.h
YHExplorer/NativeActions/Camera/YHNativeCamera.m
YHExplorer/NativeActions/ClickImageToShow/YHNativeClickToShow.m
YHExplorer/NativeActions/Device/YHNativeDevice.m
YHExplorer/NativeActions/FileSystem/YHNativeFS.m
YHExplorer/NativeActions/LBS/YHNaviteLBS.m
YHExplorer/NativeActions/Media/YHNativeMedia.m
YHExplorer/NativeActions/Message/YHNative_Message.h
YHExplorer/NativeActions/Message/YHNative_Message.m
YHExplorer/NativeActions/Motion/YHNativeMotion.m
YHExplorer/NativeActions/YHNative.h
YHExplorer/NativeActions/YHNative.m
YHExplorer/YHExplorerViewController.h
YHExplorer/YHExplorerViewController.m
YHExplorer/cordova.js
YohoExplorerDemo/YohoExplorerDemo.xcodeproj/project.pbxproj
YohoExplorerDemo/YohoExplorerDemo/Base.lproj/Main.storyboard
YohoExplorerDemo/YohoExplorerDemo/Info.plist
YohoExplorerDemo/YohoExplorerDemo/ViewController.m
YohoExplorerDemo/YohoExplorerDemo/WebViewController.m
YHExplorer/CordovaPlugins/CDVYHInterface.m
View file @
c60e43a
...
...
@@ -86,7 +86,7 @@
__weak
typeof
(
native
)
wn
=
native
;
[
native
workWithMethod
:
action
options
:
options
success
:
^
(
NSDictionary
*
info
,
BOOL
keepCallback
)
{
[
native
workWithMethod
:
action
options
:
options
success
:
^
(
NSDictionary
*
info
,
BOOL
keepCallback
,
NSDictionary
*
nativeInfo
)
{
NSDictionary
*
retDict
=
nil
;
if
(
info
)
{
retDict
=
@
{
@"ability"
:
ability
,
@"action"
:
NSStringFromSelector
(
action
),
@"result"
:
info
}
;
...
...
@@ -97,9 +97,9 @@
pluginResult
.
keepCallback
=
@
(
keepCallback
)
;
[
weakSelf
.
commandDelegate
sendPluginResult
:
pluginResult
callbackId
:
command
.
callbackId
]
;
if
(
weakIf
&&
[
weakIf
respondsToSelector
:
@selector
(
nativeAction
:
didEndWithResult
:)])
{
if
(
weakIf
&&
[
weakIf
respondsToSelector
:
@selector
(
nativeAction
:
didEndWithResult
:
userInfo
:
)])
{
dispatch_async
(
dispatch_get_main_queue
(),
^
{
[
weakIf
nativeAction
:
wn
didEndWithResult
:
YES
]
;
[
weakIf
nativeAction
:
wn
didEndWithResult
:
YES
userInfo
:
nativeInfo
]
;
})
;
}
...
...
@@ -107,9 +107,9 @@
CDVPluginResult
*
pluginResult
=
[
CDVPluginResult
resultWithStatus
:
CDVCommandStatus_ERROR
messageAsString
:
message
]
;
[
weakSelf
.
commandDelegate
sendPluginResult
:
pluginResult
callbackId
:
command
.
callbackId
]
;
if
(
weakIf
&&
[
weakIf
respondsToSelector
:
@selector
(
nativeAction
:
didEndWithResult
:)])
{
if
(
weakIf
&&
[
weakIf
respondsToSelector
:
@selector
(
nativeAction
:
didEndWithResult
:
userInfo
:
)])
{
dispatch_async
(
dispatch_get_main_queue
(),
^
{
[
weakIf
nativeAction
:
wn
didEndWithResult
:
NO
]
;
[
weakIf
nativeAction
:
wn
didEndWithResult
:
NO
userInfo
:
nil
]
;
})
;
}
}]
;
...
...
YHExplorer/CordovaPlugins/CDVYHInterfaceDelegate.h
View file @
c60e43a
...
...
@@ -34,6 +34,6 @@
* @param native YHNative对象
* @param success 执行结果
*/
-
(
void
)
nativeAction
:(
YHNative
*
)
native
didEndWithResult
:(
BOOL
)
success
;
-
(
void
)
nativeAction
:(
YHNative
*
)
native
didEndWithResult
:(
BOOL
)
success
userInfo
:(
NSDictionary
*
)
userInfo
;
@end
...
...
YHExplorer/NativeActions/Camera/YHNativeCamera.m
View file @
c60e43a
...
...
@@ -114,7 +114,7 @@ static NSString *toBase64(NSData *data) {
UIImage
*
image
=
[
self
retrieveImage
:
info
];
NSData
*
data
=
[
self
processImage
:
image
info
:
info
];
self
.
successCallBack
(
@
{
@"image"
:
toBase64
(
data
)},
NO
);
self
.
successCallBack
(
@
{
@"image"
:
toBase64
(
data
)},
NO
,
nil
);
[
self
.
rootViewController
dismissViewControllerAnimated
:
YES
completion
:
^
{}];
}
...
...
YHExplorer/NativeActions/ClickImageToShow/YHNativeClickToShow.m
View file @
c60e43a
...
...
@@ -31,9 +31,9 @@ NSString * const YHNative_ClickToShowImage = @"YHNativeClickToShow";
if
(
url
.
length
==
0
)
{
self
.
failureCallBack
(
@"No picture data found"
);
}
else
{
url
=
[
url
stringByReplacingOccurrencesOfString
:
@"data:image/png;base64,"
withString
:
@""
];
NSData
*
data
=
[
NSData
cdv_dataFromBase64String
:
url
];
UIImage
*
image
=
[
UIImage
imageWithData
:
data
];
// url = [url stringByReplacingOccurrencesOfString:@"data:image/png;base64," withString:@""];
// NSData *data = [NSData cdv_dataFromBase64String:url];
// UIImage *image = [UIImage imageWithData:data];
}
}
...
...
YHExplorer/NativeActions/Device/YHNativeDevice.m
View file @
c60e43a
...
...
@@ -38,7 +38,7 @@ NSString * const YHNative_Device = @"Native_Device";
NSString
*
platform
=
[
UIDevice
currentDevice
].
systemName
;
NSString
*
osversion
=
[
UIDevice
currentDevice
].
systemVersion
;
self
.
successCallBack
(
@
{
@"model"
:
model
,
@"platform"
:
platform
,
@"os_version"
:
osversion
},
NO
);
self
.
successCallBack
(
@
{
@"model"
:
model
,
@"platform"
:
platform
,
@"os_version"
:
osversion
},
NO
,
nil
);
}
-
(
NSArray
*
)
availableFunctions
...
...
YHExplorer/NativeActions/FileSystem/YHNativeFS.m
View file @
c60e43a
...
...
@@ -26,19 +26,19 @@ NSString * const YHNative_FS = @"Native_FS";
{
NSString
*
path
=
[
NSSearchPathForDirectoriesInDomains
(
NSDocumentDirectory
,
NSUserDomainMask
,
YES
)
firstObject
];
self
.
successCallBack
(
@
{
@"path"
:
path
},
NO
);
self
.
successCallBack
(
@
{
@"path"
:
path
},
NO
,
nil
);
}
-
(
void
)
getTemporaryPath
{
NSString
*
temp
=
NSTemporaryDirectory
();
self
.
successCallBack
(
@
{
@"path"
:
temp
},
NO
);
self
.
successCallBack
(
@
{
@"path"
:
temp
},
NO
,
nil
);
}
-
(
void
)
getCachePath
{
NSString
*
path
=
[
NSSearchPathForDirectoriesInDomains
(
NSCachesDirectory
,
NSUserDomainMask
,
YES
)
firstObject
];
self
.
successCallBack
(
@
{
@"path"
:
path
},
NO
);
self
.
successCallBack
(
@
{
@"path"
:
path
},
NO
,
nil
);
}
-
(
void
)
deleteItemAtPath
...
...
@@ -51,7 +51,7 @@ NSString * const YHNative_FS = @"Native_FS";
if
(
error
)
{
self
.
failureCallBack
(
error
.
description
);
}
else
{
self
.
successCallBack
(
@
{
@"path"
:
path
},
NO
);
self
.
successCallBack
(
@
{
@"path"
:
path
},
NO
,
nil
);
}
}
else
{
self
.
failureCallBack
([
NSString
stringWithFormat
:
@"File does not exist at path:%@ ."
,
path
]);
...
...
@@ -82,7 +82,7 @@ NSString * const YHNative_FS = @"Native_FS";
if
(
!
ok
)
{
self
.
failureCallBack
(
error
.
description
);
}
else
{
self
.
successCallBack
(
@
{
@"path"
:
dst
},
NO
);
self
.
successCallBack
(
@
{
@"path"
:
dst
},
NO
,
nil
);
}
}
...
...
YHExplorer/NativeActions/LBS/YHNaviteLBS.m
View file @
c60e43a
...
...
@@ -165,7 +165,7 @@ NSString * const YHNative_LBS = @"Native_LBS";
weakSelf
.
failureCallBack
([
error
description
])
;
}
else
{
CLPlacemark
*
pm
=
[
placemarks
lastObject
]
;
weakSelf
.
successCallBack
(
pm
.
addressDictionary
,
NO
)
;
weakSelf
.
successCallBack
(
pm
.
addressDictionary
,
NO
,
nil
)
;
}
weakSelf
.
geocoder
=
nil
;
}];
...
...
@@ -182,7 +182,7 @@ NSString * const YHNative_LBS = @"Native_LBS";
[
self
reverseGeoCode
:
location
];
}
else
{
self
.
successCallBack
(
@
{
@"latitude"
:
@
(
location
.
coordinate
.
latitude
),
@"longitude"
:
@
(
location
.
coordinate
.
longitude
)
},
NO
);
@"longitude"
:
@
(
location
.
coordinate
.
longitude
)
},
NO
,
nil
);
}
}
...
...
YHExplorer/NativeActions/Media/YHNativeMedia.m
View file @
c60e43a
...
...
@@ -33,7 +33,7 @@ NSString * const YHNative_Media = @"Native_Media";
}
[[
UIApplication
sharedApplication
].
keyWindow
.
rootViewController
presentViewController
:
vc
animated
:
YES
completion
:
nil
];
self
.
successCallBack
(
nil
,
NO
);
self
.
successCallBack
(
nil
,
NO
,
nil
);
}
-
(
NSArray
*
)
availableFunctions
...
...
YHExplorer/NativeActions/Message/YHNative_Message.h
0 → 100644
View file @
c60e43a
//
// YHNative_Message.h
// YohoExplorerDemo
//
// Created by gaoqiang xu on 4/12/2015.
// Copyright © 2015 gaoqiang xu. All rights reserved.
//
#import "YHNative.h"
@interface
YHNative_Message
:
YHNative
@end
...
...
YHExplorer/NativeActions/Message/YHNative_Message.m
0 → 100644
View file @
c60e43a
//
// YHNative_Message.m
// YohoExplorerDemo
//
// Created by gaoqiang xu on 4/12/2015.
// Copyright © 2015 gaoqiang xu. All rights reserved.
//
#import "YHNative_Message.h"
NSString
*
const
YHNative_Messenger
=
@"YHNativeMessage"
;
@implementation
YHNative_Message
-
(
NSString
*
)
actionName
{
return
YHNative_Messenger
;
}
-
(
void
)
handleMessage
:
(
NSDictionary
*
)
message
{
self
.
successCallBack
(
nil
,
NO
,
message
);
}
-
(
BOOL
)
respondsToSelector
:
(
SEL
)
aSelector
{
return
YES
;
}
-
(
NSMethodSignature
*
)
methodSignatureForSelector
:
(
SEL
)
aSelector
{
NSMethodSignature
*
signature
=
[
super
methodSignatureForSelector
:
aSelector
];
if
(
!
signature
)
{
return
[
self
methodSignatureForSelector
:
@selector
(
handleMessage
:)];
}
return
signature
;
}
-
(
void
)
forwardInvocation
:
(
NSInvocation
*
)
anInvocation
{
NSString
*
selector
=
NSStringFromSelector
(
anInvocation
.
selector
);
NSDictionary
*
message
=
@
{
@"event"
:
selector
};
[
self
handleMessage
:
message
];
}
@end
...
...
YHExplorer/NativeActions/Motion/YHNativeMotion.m
View file @
c60e43a
...
...
@@ -88,7 +88,7 @@ NSString * const YHNative_Motion = @"Native_Motion";
}
}
self
.
successCallBack
(
nil
,
NO
);
self
.
successCallBack
(
nil
,
NO
,
nil
);
}
-
(
void
)
clearWatchAcceleration
...
...
@@ -102,7 +102,7 @@ NSString * const YHNative_Motion = @"Native_Motion";
}
self
.
isRunning
=
NO
;
self
.
successCallBack
(
nil
,
NO
);
self
.
successCallBack
(
nil
,
NO
,
nil
);
}
-
(
void
)
watchAcceleration
...
...
@@ -143,7 +143,7 @@ NSString * const YHNative_Motion = @"Native_Motion";
[
accelProps
setValue
:[
NSNumber
numberWithDouble
:
self
.
z
*
kGravitationalConstant
]
forKey
:
@"z"
];
[
accelProps
setValue
:[
NSNumber
numberWithDouble
:
self
.
timestamp
]
forKey
:
@"timestamp"
];
self
.
successCallBack
(
accelProps
,
YES
);
self
.
successCallBack
(
accelProps
,
YES
,
nil
);
self
.
haveReturnedResult
=
YES
;
}
...
...
YHExplorer/NativeActions/YHNative.h
View file @
c60e43a
...
...
@@ -20,6 +20,8 @@ extern NSString * const YHNative_Motion;
extern
NSString
*
const
YHNative_FS
;
// 本地机能 - H5页面的图片展示到Native
extern
NSString
*
const
YHNative_ClickToShowImage
;
// 本地技能 - H5页面向webview发送自定义消息
extern
NSString
*
const
YHNative_Messenger
;
#pragma mark -
...
...
@@ -28,8 +30,9 @@ extern NSString * const YHNative_ClickToShowImage;
*
* @param info 回调数据
* @param keepCallback 是否持续回调。需要持续刷新回调数据时YES,否则NO
* @param nativeInfo 传给native的参数
*/
typedef
void
(
^
onSuccess
)(
NSDictionary
*
info
,
BOOL
keepCallback
);
typedef
void
(
^
onSuccess
)(
NSDictionary
*
info
,
BOOL
keepCallback
,
NSDictionary
*
nativeInfo
);
typedef
void
(
^
onFailure
)(
NSString
*
message
);
/**
...
...
YHExplorer/NativeActions/YHNative.m
View file @
c60e43a
...
...
@@ -16,6 +16,7 @@
#import "YHNativeMotion.h"
#import "YHNativeFS.h"
#import "YHNativeClickToShow.h"
#import "YHNative_Message.h"
@implementation
YHNative
...
...
@@ -38,8 +39,12 @@
}
else
if
([
name
isEqualToString
:
YHNative_FS
])
{
return
[
YHNativeFS
class
];
}
else
if
([
name
isEqualToString
:
YHNative_ClickToShowImage
])
{
return
[
YHNativeClickToShow
class
];
}
else
{
return
[
YHNative_Message
class
];
}
return
nil
;
...
...
@@ -56,7 +61,7 @@
NSArray
*
functions
=
[
self
availableFunctions
];
NSArray
*
function
=
[
functions
filteredArrayUsingPredicate
:[
NSPredicate
predicateWithFormat
:
@"SELF = %@"
,
methodName
]];
if
(
function
.
count
==
1
)
{
if
(
function
.
count
==
1
||
[
self
isKindOfClass
:[
YHNative_Message
class
]]
)
{
dispatch_async
(
dispatch_get_main_queue
(),
^
{
((
void
(
*
)(
id
,
SEL
))
objc_msgSend
)(
self
,
method
);
});
...
...
YHExplorer/YHExplorerViewController.h
View file @
c60e43a
...
...
@@ -116,7 +116,7 @@
* @param native YHNative对象
* @param success 执行结果
*/
-
(
void
)
nativeAction
:(
YHNative
*
)
native
didEndWithResult
:(
BOOL
)
success
;
-
(
void
)
nativeAction
:(
YHNative
*
)
native
didEndWithResult
:(
BOOL
)
success
userInfo
:(
NSDictionary
*
)
userInfo
;
@required
@end
...
...
YHExplorer/YHExplorerViewController.m
View file @
c60e43a
...
...
@@ -102,7 +102,8 @@
YHNative_Device
,
YHNative_Motion
,
YHNative_FS
,
YHNative_ClickToShowImage
,
nil
];
YHNative_ClickToShowImage
,
YHNative_Messenger
,
nil
];
}
return
_nativeAbilities
;
}
...
...
@@ -342,10 +343,10 @@
return
b
;
}
-
(
void
)
nativeAction
:
(
YHNative
*
)
native
didEndWithResult
:
(
BOOL
)
success
-
(
void
)
nativeAction
:
(
YHNative
*
)
native
didEndWithResult
:
(
BOOL
)
success
userInfo
:
(
NSDictionary
*
)
userInfo
{
if
(
self
.
delegate
&&
[
self
.
delegate
respondsToSelector
:
@selector
(
nativeAction
:
didEndWithResult
:)])
{
[
self
.
delegate
nativeAction
:
native
didEndWithResult
:
success
];
[
self
.
delegate
nativeAction
:
native
didEndWithResult
:
success
userInfo
:
userInfo
];
}
}
...
...
YHExplorer/cordova.js
View file @
c60e43a
...
...
@@ -1817,7 +1817,7 @@ define("cordova/yohoInterface", function(require, exports, module) {
}
YHInterface
.
prototype
.
triggerEvent
=
function
(
onSuccess
,
onFail
,
options
)
{
argscheck
.
checkArgs
(
'fFO'
,
'YHInterface.eventTriggered'
,
arguments
);
//
argscheck.checkArgs('fFO', 'YHInterface.eventTriggered', arguments);
options
=
options
||
{};
function
onEventCallBack
(
info
)
{
...
...
YohoExplorerDemo/YohoExplorerDemo.xcodeproj/project.pbxproj
View file @
c60e43a
...
...
@@ -52,6 +52,7 @@
50386F371B6F3E43000F62A8 /* YHExplorerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 50386F081B6F3E43000F62A8 /* YHExplorerViewController.m */; };
50386F381B6F3E43000F62A8 /* YHLinkDefaultParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 50386F0B1B6F3E43000F62A8 /* YHLinkDefaultParser.m */; };
503FA1C11BA275C9003ACF8E /* product.html in Resources */ = {isa = PBXBuildFile; fileRef = 503FA1C01BA275C9003ACF8E /* product.html */; };
5071B40F1C11734F004A4DFD /* YHNative_Message.m in Sources */ = {isa = PBXBuildFile; fileRef = 5071B40E1C11734F004A4DFD /* YHNative_Message.m */; };
50901E441AA4571D002723B1 /* WebViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 50901E431AA4571D002723B1 /* WebViewController.m */; };
50901E471AA458B6002723B1 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 50901E451AA458B6002723B1 /* Main.storyboard */; };
50A269F71BA6C72F00CA89A4 /* YHNativeClickToShow.m in Sources */ = {isa = PBXBuildFile; fileRef = 50A269F61BA6C72F00CA89A4 /* YHNativeClickToShow.m */; };
...
...
@@ -171,6 +172,8 @@
50386F0B1B6F3E43000F62A8 /* YHLinkDefaultParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YHLinkDefaultParser.m; sourceTree = "<group>"; };
50386F0C1B6F3E43000F62A8 /* YHLinkParserDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YHLinkParserDelegate.h; sourceTree = "<group>"; };
503FA1C01BA275C9003ACF8E /* product.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = product.html; sourceTree = "<group>"; };
5071B40D1C11734F004A4DFD /* YHNative_Message.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YHNative_Message.h; sourceTree = "<group>"; };
5071B40E1C11734F004A4DFD /* YHNative_Message.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YHNative_Message.m; sourceTree = "<group>"; };
50901E421AA4571D002723B1 /* WebViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebViewController.h; sourceTree = "<group>"; };
50901E431AA4571D002723B1 /* WebViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WebViewController.m; sourceTree = "<group>"; };
50901E461AA458B6002723B1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
...
...
@@ -347,6 +350,7 @@
50386EE51B6F3E43000F62A8 /* NativeActions */ = {
isa = PBXGroup;
children = (
5071B40C1C11732B004A4DFD /* Message */,
50CA26FA1BA6C6D9005E6238 /* ClickImageToShow */,
50386EE61B6F3E43000F62A8 /* Camera */,
50386EEA1B6F3E43000F62A8 /* Device */,
...
...
@@ -441,6 +445,15 @@
path = YHLinkParser;
sourceTree = "<group>";
};
5071B40C1C11732B004A4DFD /* Message */ = {
isa = PBXGroup;
children = (
5071B40D1C11734F004A4DFD /* YHNative_Message.h */,
5071B40E1C11734F004A4DFD /* YHNative_Message.m */,
);
path = Message;
sourceTree = "<group>";
};
50CA26FA1BA6C6D9005E6238 /* ClickImageToShow */ = {
isa = PBXGroup;
children = (
...
...
@@ -653,6 +666,7 @@
50386F221B6F3E43000F62A8 /* NSData+Base64.m in Sources */,
50386F131B6F3E43000F62A8 /* CDVViewController.m in Sources */,
50386F0E1B6F3E43000F62A8 /* YHURLCache.m in Sources */,
5071B40F1C11734F004A4DFD /* YHNative_Message.m in Sources */,
50A269F71BA6C72F00CA89A4 /* YHNativeClickToShow.m in Sources */,
50386F201B6F3E43000F62A8 /* CDVTimer.m in Sources */,
50E318201AA0375700D79E9E /* AppDelegate.m in Sources */,
...
...
YohoExplorerDemo/YohoExplorerDemo/Base.lproj/Main.storyboard
View file @
c60e43a
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document
type=
"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB"
version=
"3.0"
toolsVersion=
"
7531"
systemVersion=
"14D131
"
targetRuntime=
"iOS.CocoaTouch"
propertyAccessControl=
"none"
useAutolayout=
"YES"
useTraitCollections=
"YES"
initialViewController=
"k0P-Jp-hrd"
>
<document
type=
"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB"
version=
"3.0"
toolsVersion=
"
9059"
systemVersion=
"15C31f
"
targetRuntime=
"iOS.CocoaTouch"
propertyAccessControl=
"none"
useAutolayout=
"YES"
useTraitCollections=
"YES"
initialViewController=
"k0P-Jp-hrd"
>
<dependencies>
<deployment
identifier=
"iOS"
/>
<plugIn
identifier=
"com.apple.InterfaceBuilder.IBCocoaTouchPlugin"
version=
"
7520
"
/>
<plugIn
identifier=
"com.apple.InterfaceBuilder.IBCocoaTouchPlugin"
version=
"
9049
"
/>
</dependencies>
<scenes>
<!--View Controller-->
...
...
@@ -19,14 +19,18 @@
<subviews>
<tableView
clipsSubviews=
"YES"
contentMode=
"scaleToFill"
alwaysBounceVertical=
"YES"
dataMode=
"prototypes"
style=
"plain"
separatorStyle=
"default"
rowHeight=
"44"
sectionHeaderHeight=
"22"
sectionFooterHeight=
"22"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"lOJ-t4-qGa"
>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"600"
height=
"600"
/>
<animations/>
<color
key=
"backgroundColor"
white=
"1"
alpha=
"1"
colorSpace=
"calibratedWhite"
/>
<prototypes>
<tableViewCell
contentMode=
"scaleToFill"
selectionStyle=
"default"
indentationWidth=
"10"
reuseIdentifier=
"cell"
id=
"Hgq-y0-WeU"
>
<rect
key=
"frame"
x=
"0.0"
y=
"
0.0
"
width=
"600"
height=
"44"
/>
<rect
key=
"frame"
x=
"0.0"
y=
"
86
"
width=
"600"
height=
"44"
/>
<autoresizingMask
key=
"autoresizingMask"
/>
<tableViewCellContentView
key=
"contentView"
opaque=
"NO"
clipsSubviews=
"YES"
multipleTouchEnabled=
"YES"
contentMode=
"center"
tableViewCell=
"Hgq-y0-WeU"
id=
"d6K-Cq-2Mn"
>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"600"
height=
"43.5"
/>
<autoresizingMask
key=
"autoresizingMask"
/>
<animations/>
</tableViewCellContentView>
<animations/>
</tableViewCell>
</prototypes>
<connections>
...
...
@@ -35,6 +39,7 @@
</connections>
</tableView>
</subviews>
<animations/>
<color
key=
"backgroundColor"
white=
"1"
alpha=
"1"
colorSpace=
"custom"
customColorSpace=
"calibratedWhite"
/>
<constraints>
<constraint
firstItem=
"lOJ-t4-qGa"
firstAttribute=
"leading"
secondItem=
"kh9-bI-dsS"
secondAttribute=
"leading"
id=
"Bck-8A-OGu"
/>
...
...
@@ -72,9 +77,11 @@
<subviews>
<view
contentMode=
"scaleToFill"
misplaced=
"YES"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"ETY-2e-CN9"
customClass=
"YHExplorerView"
>
<rect
key=
"frame"
x=
"0.0"
y=
"64"
width=
"600"
height=
"536"
/>
<animations/>
<color
key=
"backgroundColor"
white=
"1"
alpha=
"1"
colorSpace=
"calibratedWhite"
/>
</view>
</subviews>
<animations/>
<color
key=
"backgroundColor"
white=
"1"
alpha=
"1"
colorSpace=
"calibratedWhite"
/>
<constraints>
<constraint
firstItem=
"ETY-2e-CN9"
firstAttribute=
"leading"
secondItem=
"JdQ-Rm-8en"
secondAttribute=
"leading"
id=
"0L7-ku-mAG"
/>
...
...
@@ -99,6 +106,7 @@
<navigationBar
key=
"navigationBar"
contentMode=
"scaleToFill"
id=
"MlO-ww-P67"
>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"320"
height=
"44"
/>
<autoresizingMask
key=
"autoresizingMask"
/>
<animations/>
</navigationBar>
<nil
name=
"viewControllers"
/>
<connections>
...
...
YohoExplorerDemo/YohoExplorerDemo/Info.plist
View file @
c60e43a
...
...
@@ -40,5 +40,10 @@
<array>
<string>
UIInterfaceOrientationPortrait
</string>
</array>
<key>
NSAppTransportSecurity
</key>
<dict>
<key>
NSAllowsArbitraryLoads
</key>
<true/>
</dict>
</dict>
</plist>
...
...
YohoExplorerDemo/YohoExplorerDemo/ViewController.m
View file @
c60e43a
...
...
@@ -73,7 +73,7 @@
}
else
if
([
title
isEqualToString
:
@"链接跳转"
])
{
wv
.
url
=
@"http://sealedace.com/content/images/test/h5_test.html"
;
}
else
{
wv
.
url
=
@"http://
m.taobao.com
"
;
wv
.
url
=
@"http://
yohomars.test.yoho.cn/message/index?uid=8654049&session_code=00840ce1bccbf76c3b9b6ab34e0c5f50
"
;
}
[
self
.
navigationController
pushViewController
:
wv
animated
:
YES
];
...
...
YohoExplorerDemo/YohoExplorerDemo/WebViewController.m
View file @
c60e43a
...
...
@@ -35,13 +35,10 @@
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
// Do any additional setup after loading the view.
self
.
webView
.
delegate
=
self
;
self
.
webView
.
enableProgressBar
=
YES
;
YHLinkParserOld
*
parser
=
[[
YHLinkParserOld
alloc
]
init
];
[
self
.
webView
registerLinkParser
:
parser
];
//
[self.webView loadWebUrl:self.url];
[
self
.
webView
loadWebUrl
:
self
.
url
];
// [self.webView loadWebUrl:[[NSBundle mainBundle] pathForResource:@"untitled" ofType:@"html"]];
}
...
...
@@ -49,11 +46,11 @@
{
[
super
viewDidAppear
:
animated
];
NSString
*
html
=
[[
NSString
alloc
]
initWithContentsOfFile
:[[
NSBundle
mainBundle
]
pathForResource
:
@"product"
ofType
:
@"html"
]
encoding
:
NSUTF8StringEncoding
error
:
nil
];
[
self
.
webView
loadHTMLString
:
html
];
// NSString *html = [[NSString alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"product"
// ofType:@"html"]
// encoding:NSUTF8StringEncoding
// error:nil];
// [self.webView loadHTMLString:html];
}
#pragma mark - YHExplorerDelegate
...
...
@@ -70,9 +67,9 @@
return
YES
;
}
-
(
void
)
nativeAction
:
(
YHNative
*
)
native
didEndWithResult
:
(
BOOL
)
success
-
(
void
)
nativeAction
:
(
YHNative
*
)
native
didEndWithResult
:
(
BOOL
)
success
userInfo
:
(
NSDictionary
*
)
userInfo
{
NSLog
(
@"nativeAction didEndWithResult userInfo: %@"
,
userInfo
);
}
-
(
void
)
explorerDidDetectParameters
:
(
NSDictionary
*
)
params
...
...
Please
register
or
login
to post a comment