Skip to content

Commit b8bb314

Browse files
Add MKMapView sample.
1 parent a1c6be1 commit b8bb314

8 files changed

Lines changed: 209 additions & 32 deletions

File tree

Examples/UICatalog/UICatalog.xcodeproj/project.pbxproj

Lines changed: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10-
149AE1091876E8BC00018A8C /* buttonsViewController.js in Resources */ = {isa = PBXBuildFile; fileRef = 149AE1081876E8BC00018A8C /* buttonsViewController.js */; };
11-
149AE10B1876F32D00018A8C /* mainViewController.js in Resources */ = {isa = PBXBuildFile; fileRef = 149AE10A1876F32D00018A8C /* mainViewController.js */; };
12-
149B8722187714BB0074B480 /* controlsViewController.js in Resources */ = {isa = PBXBuildFile; fileRef = 149B8721187714BB0074B480 /* controlsViewController.js */; };
13-
149B87241877199C0074B480 /* webViewController.js in Resources */ = {isa = PBXBuildFile; fileRef = 149B87231877199C0074B480 /* webViewController.js */; };
1410
149B874A1877D9440074B480 /* JSContext+JavaScriptBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = 149B87471877D9440074B480 /* JSContext+JavaScriptBridge.m */; };
1511
149B874B1877D9440074B480 /* UIControl+JavaScriptBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = 149B87491877D9440074B480 /* UIControl+JavaScriptBridge.m */; };
1612
149C53A51875C5870003EE16 /* JSBScriptingSupport.m in Sources */ = {isa = PBXBuildFile; fileRef = 149C53A21875C5870003EE16 /* JSBScriptingSupport.m */; };
@@ -45,21 +41,22 @@
4541
149C56851875C5BB0003EE16 /* JSBTwitter.m in Sources */ = {isa = PBXBuildFile; fileRef = 149C55DA1875C5BB0003EE16 /* JSBTwitter.m */; };
4642
149C56861875C5BB0003EE16 /* JSBUIKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 149C56171875C5BB0003EE16 /* JSBUIKit.m */; };
4743
149C56871875C5BB0003EE16 /* JSBiAd.m in Sources */ = {isa = PBXBuildFile; fileRef = 149C56681875C5BB0003EE16 /* JSBiAd.m */; };
44+
14A045081877E7E3004831E8 /* main.js in Resources */ = {isa = PBXBuildFile; fileRef = 14A044FF1877E7B1004831E8 /* main.js */; };
45+
14A045091877E7E3004831E8 /* mainViewController.js in Resources */ = {isa = PBXBuildFile; fileRef = 14A045001877E7B1004831E8 /* mainViewController.js */; };
46+
14A0450A1877E7E3004831E8 /* buttonsViewController.js in Resources */ = {isa = PBXBuildFile; fileRef = 14A044FD1877E7B1004831E8 /* buttonsViewController.js */; };
47+
14A0450B1877E7E3004831E8 /* controlsViewController.js in Resources */ = {isa = PBXBuildFile; fileRef = 14A044FE1877E7B1004831E8 /* controlsViewController.js */; };
48+
14A0450C1877E7E3004831E8 /* webViewController.js in Resources */ = {isa = PBXBuildFile; fileRef = 14A045011877E7B1004831E8 /* webViewController.js */; };
49+
14A0450E1877E870004831E8 /* mapViewController.js in Resources */ = {isa = PBXBuildFile; fileRef = 14A0450D1877E870004831E8 /* mapViewController.js */; };
4850
14B5CD201875C3740019A135 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 14B5CD1F1875C3740019A135 /* Foundation.framework */; };
4951
14B5CD221875C3740019A135 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 14B5CD211875C3740019A135 /* CoreGraphics.framework */; };
5052
14B5CD241875C3740019A135 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 14B5CD231875C3740019A135 /* UIKit.framework */; };
5153
14B5CD2A1875C3740019A135 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 14B5CD281875C3740019A135 /* InfoPlist.strings */; };
5254
14B5CD2C1875C3740019A135 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 14B5CD2B1875C3740019A135 /* main.m */; };
5355
14B5CD301875C3740019A135 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 14B5CD2F1875C3740019A135 /* AppDelegate.m */; };
5456
14B5CD321875C3740019A135 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 14B5CD311875C3740019A135 /* Images.xcassets */; };
55-
14B5CD4F1875C3FF0019A135 /* main.js in Resources */ = {isa = PBXBuildFile; fileRef = 14B5CD4E1875C3FF0019A135 /* main.js */; };
5657
/* End PBXBuildFile section */
5758

5859
/* Begin PBXFileReference section */
59-
149AE1081876E8BC00018A8C /* buttonsViewController.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = buttonsViewController.js; sourceTree = "<group>"; };
60-
149AE10A1876F32D00018A8C /* mainViewController.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = mainViewController.js; sourceTree = "<group>"; };
61-
149B8721187714BB0074B480 /* controlsViewController.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = controlsViewController.js; sourceTree = "<group>"; };
62-
149B87231877199C0074B480 /* webViewController.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = webViewController.js; sourceTree = "<group>"; };
6360
149B87461877D9440074B480 /* JSContext+JavaScriptBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "JSContext+JavaScriptBridge.h"; path = "../../../Classes/JSContext+JavaScriptBridge.h"; sourceTree = "<group>"; };
6461
149B87471877D9440074B480 /* JSContext+JavaScriptBridge.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "JSContext+JavaScriptBridge.m"; path = "../../../Classes/JSContext+JavaScriptBridge.m"; sourceTree = "<group>"; };
6562
149B87481877D9440074B480 /* UIControl+JavaScriptBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIControl+JavaScriptBridge.h"; path = "../../../Classes/UIControl+JavaScriptBridge.h"; sourceTree = "<group>"; };
@@ -741,6 +738,12 @@
741738
149C56671875C5BB0003EE16 /* JSBiAd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSBiAd.h; sourceTree = "<group>"; };
742739
149C56681875C5BB0003EE16 /* JSBiAd.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSBiAd.m; sourceTree = "<group>"; };
743740
14A044FC1877DD5E004831E8 /* JSBMessageForwarding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSBMessageForwarding.h; path = ../../../Classes/JSBMessageForwarding.h; sourceTree = "<group>"; };
741+
14A044FD1877E7B1004831E8 /* buttonsViewController.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = buttonsViewController.js; path = js/buttonsViewController.js; sourceTree = "<group>"; };
742+
14A044FE1877E7B1004831E8 /* controlsViewController.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = controlsViewController.js; path = js/controlsViewController.js; sourceTree = "<group>"; };
743+
14A044FF1877E7B1004831E8 /* main.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = main.js; path = js/main.js; sourceTree = "<group>"; };
744+
14A045001877E7B1004831E8 /* mainViewController.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = mainViewController.js; path = js/mainViewController.js; sourceTree = "<group>"; };
745+
14A045011877E7B1004831E8 /* webViewController.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = webViewController.js; path = js/webViewController.js; sourceTree = "<group>"; };
746+
14A0450D1877E870004831E8 /* mapViewController.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = mapViewController.js; path = js/mapViewController.js; sourceTree = "<group>"; };
744747
14B5CD1C1875C3740019A135 /* UICatalog.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = UICatalog.app; sourceTree = BUILT_PRODUCTS_DIR; };
745748
14B5CD1F1875C3740019A135 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
746749
14B5CD211875C3740019A135 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
@@ -753,7 +756,6 @@
753756
14B5CD2F1875C3740019A135 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
754757
14B5CD311875C3740019A135 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
755758
14B5CD381875C3750019A135 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; };
756-
14B5CD4E1875C3FF0019A135 /* main.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = main.js; sourceTree = "<group>"; };
757759
/* End PBXFileReference section */
758760

759761
/* Begin PBXFrameworksBuildPhase section */
@@ -1723,6 +1725,19 @@
17231725
path = iAd;
17241726
sourceTree = "<group>";
17251727
};
1728+
14A045071877E7B5004831E8 /* js */ = {
1729+
isa = PBXGroup;
1730+
children = (
1731+
14A044FF1877E7B1004831E8 /* main.js */,
1732+
14A045001877E7B1004831E8 /* mainViewController.js */,
1733+
14A044FD1877E7B1004831E8 /* buttonsViewController.js */,
1734+
14A044FE1877E7B1004831E8 /* controlsViewController.js */,
1735+
14A045011877E7B1004831E8 /* webViewController.js */,
1736+
14A0450D1877E870004831E8 /* mapViewController.js */,
1737+
);
1738+
name = js;
1739+
sourceTree = "<group>";
1740+
};
17261741
14B5CD131875C3740019A135 = {
17271742
isa = PBXGroup;
17281743
children = (
@@ -1757,12 +1772,8 @@
17571772
children = (
17581773
14B5CD2E1875C3740019A135 /* AppDelegate.h */,
17591774
14B5CD2F1875C3740019A135 /* AppDelegate.m */,
1760-
14B5CD4E1875C3FF0019A135 /* main.js */,
1761-
149AE10A1876F32D00018A8C /* mainViewController.js */,
1762-
149AE1081876E8BC00018A8C /* buttonsViewController.js */,
1763-
149B8721187714BB0074B480 /* controlsViewController.js */,
1764-
149B87231877199C0074B480 /* webViewController.js */,
17651775
14B5CD311875C3740019A135 /* Images.xcassets */,
1776+
14A045071877E7B5004831E8 /* js */,
17661777
14B5CD261875C3740019A135 /* Supporting Files */,
17671778
149C53A71875C59C0003EE16 /* Vendor */,
17681779
);
@@ -1831,11 +1842,12 @@
18311842
isa = PBXResourcesBuildPhase;
18321843
buildActionMask = 2147483647;
18331844
files = (
1834-
14B5CD4F1875C3FF0019A135 /* main.js in Resources */,
1835-
149AE10B1876F32D00018A8C /* mainViewController.js in Resources */,
1836-
149AE1091876E8BC00018A8C /* buttonsViewController.js in Resources */,
1837-
149B8722187714BB0074B480 /* controlsViewController.js in Resources */,
1838-
149B87241877199C0074B480 /* webViewController.js in Resources */,
1845+
14A045081877E7E3004831E8 /* main.js in Resources */,
1846+
14A045091877E7E3004831E8 /* mainViewController.js in Resources */,
1847+
14A0450A1877E7E3004831E8 /* buttonsViewController.js in Resources */,
1848+
14A0450B1877E7E3004831E8 /* controlsViewController.js in Resources */,
1849+
14A0450C1877E7E3004831E8 /* webViewController.js in Resources */,
1850+
14A0450E1877E870004831E8 /* mapViewController.js in Resources */,
18391851
14B5CD2A1875C3740019A135 /* InfoPlist.strings in Resources */,
18401852
14B5CD321875C3740019A135 /* Images.xcassets in Resources */,
18411853
);

Examples/UICatalog/UICatalog/AppDelegate.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
1919
NSString *script = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil];
2020

2121
JSContext *context = [JSBScriptingSupport globalContext];
22+
[context addScriptingSupport:@"MapKit"];
2223
[context evaluateScript:script];
2324

2425
return YES;
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
var ButtonsViewController = JSB.define('ButtonsViewController : UITableViewController', {
2+
viewDidLoad: function() {
3+
self.newButton = function(title, target, selector, frame, image, imagePressed, darkTextColor) {
4+
var button = UIButton.alloc().initWithFrame(frame);
5+
6+
button.contentVerticalAlignment = 0;
7+
button.contentHorizontalAlignment = 0;
8+
9+
button.setTitleForState(title, 0);
10+
if (darkTextColor) {
11+
button.setTitleColorForState(UIColor.blackColor(), 0);
12+
} else {
13+
button.setTitleColorForState(UIColor.whiteColor(), 0);
14+
}
15+
16+
var newImage = image.stretchableImageWithLeftCapWidthTopCapHeight(12, 0);
17+
button.setBackgroundImageForState(newImage, 0);
18+
19+
var newPressedImage = imagePressed.stretchableImageWithLeftCapWidthTopCapHeight(12, 0);
20+
button.setBackgroundImageForState(newPressedImage, 1 << 0);
21+
22+
button.backgroundColor = UIColor.clearColor();
23+
24+
button.addTargetActionForControlEvents(target, selector, 1 << 6);
25+
26+
return button;
27+
};
28+
29+
self.grayButton = function() {
30+
var buttonBackground = UIImage.imageNamed('whiteButton');
31+
var buttonBackgroundPressed = UIImage.imageNamed('blueButton');
32+
33+
var frame = {x: 0, y: 5, width: 106, height: 40};
34+
var button = self.newButton('Gray', self, 'action:', frame, buttonBackground, buttonBackgroundPressed, true);
35+
36+
button.tag = 1;
37+
38+
return button;
39+
};
40+
41+
self.imageButton = function() {
42+
var buttonBackground = UIImage.imageNamed('whiteButton');
43+
var buttonBackgroundPressed = UIImage.imageNamed('blueButton');
44+
45+
var frame = {x: 0, y: 5, width: 106, height: 40};
46+
47+
var button = self.newButton('', self, 'action:', frame, buttonBackground, buttonBackgroundPressed, true);
48+
button.setImageForState(UIImage.imageNamed('UIButton_custom'), 0);
49+
50+
return button;
51+
}
52+
53+
self.navigationItem.title = 'Buttons';
54+
55+
self.dataSourceArray = [{
56+
sectionTitleKey: 'UIButton',
57+
labelKey: 'Background Image',
58+
sourceKey: 'ButtonsViewController.m:\r(UIButton *)grayButton',
59+
viewKey: self.grayButton()
60+
},
61+
{
62+
sectionTitleKey: 'UIButton',
63+
labelKey: 'Button with Image',
64+
sourceKey: 'ButtonsViewController.m:\r(UIButton *)imageButton',
65+
viewKey: self.imageButton()
66+
}];
67+
},
68+
numberOfSectionsInTableView: function(tableView) {
69+
return self.dataSourceArray.length;
70+
},
71+
tableViewNumberOfRowsInSection: function(tableView, section) {
72+
return 2;
73+
},
74+
tableViewTitleForHeaderInSection: function(tableView, section) {
75+
return self.dataSourceArray[section]['sectionTitleKey'];
76+
},
77+
tableViewHeightForRowAtIndexPath: function(tableView, indexPath) {
78+
return (indexPath.row == 0) ? 50 : 38;
79+
},
80+
tableViewCellForRowAtIndexPath: function(tableView, indexPath) {
81+
if (indexPath.row == 0) {
82+
var cell = UITableViewCell.alloc().initWithStyleReuseIdentifier(0, 'DisplayCellID');
83+
cell.selectionStyle = 0;
84+
85+
var viewToRemove = null;
86+
viewToRemove = cell.contentView.viewWithTag(1);
87+
if (viewToRemove) {
88+
viewToRemove.removeFromSuperview();
89+
}
90+
91+
cell.textLabel.text = self.dataSourceArray[indexPath.section]['labelKey'];
92+
var button = self.dataSourceArray[indexPath.section]['viewKey'];
93+
94+
var newFrame = button.frame;
95+
newFrame.x = cell.contentView.frame.width - newFrame.width - 10;
96+
button.frame = newFrame;
97+
98+
button.autoresizingMask = 1 << 0;
99+
100+
cell.contentView.addSubview(button);
101+
102+
return cell;
103+
} else {
104+
var cell = UITableViewCell.alloc().initWithStyleReuseIdentifier(0, 'SourceCellID');
105+
cell.selectionStyle = 0;
106+
107+
cell.textLabel.opaque = false;
108+
cell.textLabel.textAlignment = 1;
109+
cell.textLabel.textColor = UIColor.grayColor();
110+
cell.textLabel.numberOfLines = 2;
111+
cell.textLabel.highlightedTextColor = UIColor.blackColor();
112+
cell.textLabel.font = UIFont.systemFontOfSize(12);
113+
cell.textLabel.text = self.dataSourceArray[indexPath.section]['sourceKey'];
114+
115+
return cell;
116+
}
117+
},
118+
action: function(sender) {
119+
// var alertView = UIAlertView.alloc().initWithTitleMessageDelegateCancelButtonTitleOtherButtonTitles('Alert', 'Button pushed.', null, 'Cancel', 'OK', null);
120+
var alertView = UIAlertView.new();
121+
alertView.message = 'Button pushed.';
122+
alertView.addButtonWithTitle('OK');
123+
alertView.show();
124+
}
125+
});
126+
127+
JSB.exports = ButtonsViewController;

Examples/UICatalog/UICatalog/controlsViewController.js renamed to Examples/UICatalog/UICatalog/js/controlsViewController.js

File renamed without changes.

Examples/UICatalog/UICatalog/mainViewController.js renamed to Examples/UICatalog/UICatalog/js/mainViewController.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
var ButtonsViewController = JSB.require('buttonsViewController');
22
var ControlsViewController = JSB.require('controlsViewController');
33
var WebViewController = JSB.require('webViewController');
4+
var MapViewController = JSB.require('mapViewController');
45

56
var MainViewController = JSB.define('MainViewController : UITableViewController', {
67
viewDidLoad: function() {
@@ -20,6 +21,11 @@ var MainViewController = JSB.define('MainViewController : UITableViewController'
2021
title: 'Web',
2122
explanation: 'Use of UIWebView',
2223
viewController: WebViewController.alloc().init()
24+
},
25+
{
26+
title: 'Map',
27+
explanation: 'Use of MKMapView',
28+
viewController: MapViewController.alloc().init()
2329
}]
2430
},
2531
tableViewNumberOfRowsInSection: function(tableView, section) {
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
var MapViewController = JSB.define('MapViewController : UIViewController <MKMapViewDelegate>', {
2+
viewDidLoad: function() {
3+
self.navigationItem.title = 'Map';
4+
5+
self.edgesForExtendedLayout = 0;
6+
7+
var frame = self.view.frame;
8+
9+
self.mapView = MKMapView.alloc().initWithFrame(frame);
10+
11+
self.mapView.backgroundColor = UIColor.whiteColor();
12+
self.mapView.autoresizingMask = (1 << 1 | 1 << 4 | 1 << 5);
13+
self.mapView.showsUserLocation = true;
14+
self.mapView.delegate = self;
15+
self.view.addSubview(self.mapView);
16+
},
17+
viewWillAppear: function(animated) {
18+
self.mapView.delegate = self;
19+
},
20+
viewWillDisappear: function(animated) {
21+
self.mapView.delegate = null;
22+
},
23+
webViewDidStartLoad: function(webView) {
24+
UIApplication.sharedApplication().networkActivityIndicatorVisible = true;
25+
},
26+
webViewDidFinishLoad: function(webView) {
27+
UIApplication.sharedApplication().networkActivityIndicatorVisible = false;
28+
}
29+
});
30+
31+
JSB.exports = MapViewController;

Examples/UICatalog/UICatalog/webViewController.js renamed to Examples/UICatalog/UICatalog/js/webViewController.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,28 +25,28 @@ var WebViewController = JSB.define('WebViewController : UIViewController <UIText
2525
webFrame.y += (6 * 2) + 30;
2626
webFrame.height -= 40;
2727

28-
self.myWebView = UIWebView.alloc().initWithFrame(webFrame);
28+
self.webView = UIWebView.alloc().initWithFrame(webFrame);
2929

30-
self.myWebView.backgroundColor = UIColor.whiteColor();
31-
self.myWebView.scalesPageToFit = true;
32-
self.myWebView.autoresizingMask = (1 << 1 | 1 << 4 | 1 << 5);
33-
self.myWebView.delegate = self;
34-
self.view.addSubview(self.myWebView);
30+
self.webView.backgroundColor = UIColor.whiteColor();
31+
self.webView.scalesPageToFit = true;
32+
self.webView.autoresizingMask = (1 << 1 | 1 << 4 | 1 << 5);
33+
self.webView.delegate = self;
34+
self.view.addSubview(self.webView);
3535

36-
self.myWebView.loadRequest(NSURLRequest.requestWithURL(NSURL.URLWithString('http://www.apple.com/')));
36+
self.webView.loadRequest(NSURLRequest.requestWithURL(NSURL.URLWithString('http://www.apple.com/')));
3737
},
3838
viewWillAppear: function(animated) {
39-
self.myWebView.delegate = self;
39+
self.webView.delegate = self;
4040
},
4141
viewWillDisappear: function(animated) {
42-
self.myWebView.stopLoading();
43-
self.myWebView.delegate = null;
42+
self.webView.stopLoading();
43+
self.webView.delegate = null;
4444

4545
UIApplication.sharedApplication().networkActivityIndicatorVisible = false;
4646
},
4747
textFieldShouldReturn: function(textField) {
4848
textField.resignFirstResponder();
49-
self.myWebView.loadRequest(NSURLRequest.requestWithURL(NSURL.URLWithString(textField.text)));
49+
self.webView.loadRequest(NSURLRequest.requestWithURL(NSURL.URLWithString(textField.text)));
5050

5151
return true;
5252
},
@@ -62,7 +62,7 @@ var WebViewController = JSB.define('WebViewController : UIViewController <UIText
6262
var errorString = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\"><html><head><meta http-equiv='Content-Type' content='text/html;charset=utf-8'><title></title></head><body><div style='width: 100%%; text-align: center; font-size: 36pt; color: red;'>An error occurred:<br>%@</div></body></html>";
6363
errorString = errorString.replace("%@", error.localizedDescription);
6464

65-
self.myWebView.loadHTMLStringBaseURL(errorString, null);
65+
self.webView.loadHTMLStringBaseURL(errorString, null);
6666
}
6767
});
6868

0 commit comments

Comments
 (0)