WebPage loading

This commit is contained in:
Kilian Hofmann 2016-04-18 13:20:07 +02:00
parent 37a44af92c
commit 99b05d2c7f
6 changed files with 141 additions and 17 deletions

View File

@ -2,4 +2,38 @@
<Bucket
type = "0"
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "FMC Planner 2/ViewControllerRouteRequest.m"
timestampString = "482668097.657951"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "31"
endingLineNumber = "31"
landmarkName = "-parseRoute"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "FMC Planner 2/ViewControllerRouteRequest.m"
timestampString = "482670260.958538"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "36"
endingLineNumber = "36"
landmarkName = "-webViewDidStartLoad:"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>

View File

@ -203,8 +203,6 @@
E2A9270E1CA2FE5200606E07 /* Header */,
E22EE9DB1C9DB7B3001F5BC0 /* Assets.xcassets */,
E22EE9E01C9DB7B3001F5BC0 /* Info.plist */,
E20D7B4E1CBE807700FF3C70 /* NavDataParser.h */,
E20D7B4F1CBE807700FF3C70 /* NavDataParser.m */,
);
name = "Supporting Files";
sourceTree = "<group>";
@ -287,6 +285,7 @@
children = (
E22EE9D21C9DB7B3001F5BC0 /* AppDelegate.h */,
E2549C741CAB2D3F00562602 /* DropboxV2ObjC.h */,
E20D7B4E1CBE807700FF3C70 /* NavDataParser.h */,
E2A927141CA30CEE00606E07 /* SharedDeclerations.h */,
);
name = Header;
@ -298,6 +297,7 @@
E22EE9D31C9DB7B3001F5BC0 /* AppDelegate.m */,
E2549C751CAB2D3F00562602 /* DropboxV2ObjC.m */,
E22EE9D01C9DB7B3001F5BC0 /* main.m */,
E20D7B4F1CBE807700FF3C70 /* NavDataParser.m */,
E2A927151CA30CEE00606E07 /* SharedDeclerations.m */,
);
name = Implementation;

View File

@ -3,6 +3,9 @@
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
<capability name="Alignment constraints to the first baseline" minToolsVersion="6.0"/>
<capability name="Alignment constraints with different attributes" minToolsVersion="5.1"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
</dependencies>
<scenes>
<!--View Controller-->
@ -1075,10 +1078,6 @@
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<webView contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="S10-Dt-JJr">
<rect key="frame" x="0.0" y="20" width="320" height="449"/>
<color key="backgroundColor" red="0.36078431370000003" green="0.38823529410000002" blue="0.4039215686" alpha="1" colorSpace="deviceRGB"/>
</webView>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" text="Copy Route to here" translatesAutoresizingMaskIntoConstraints="NO" id="ixb-cc-5YB">
<rect key="frame" x="0.0" y="470" width="320" height="98"/>
<color key="backgroundColor" red="0.82352941176470584" green="0.82352941176470584" blue="0.82352941176470584" alpha="1" colorSpace="calibratedRGB"/>
@ -1099,24 +1098,76 @@
<action selector="ok:" destination="OL3-89-hAR" eventType="touchUpInside" id="Jmk-1Z-273"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="3Kp-dS-bR4">
<rect key="frame" x="3" y="24" width="22" height="22"/>
<color key="backgroundColor" red="0.82352941176470584" green="0.82352941176470584" blue="0.82352941176470584" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="width" constant="22" id="RjN-YG-crv"/>
<constraint firstAttribute="height" constant="22" id="cH3-HA-Kqf"/>
</constraints>
<state key="normal" title="&lt;"/>
<connections>
<action selector="goBack" destination="S10-Dt-JJr" eventType="touchUpInside" id="Vkv-bT-lWi"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Lvb-Db-aer">
<rect key="frame" x="33" y="24" width="22" height="22"/>
<color key="backgroundColor" red="0.82352941176470584" green="0.82352941176470584" blue="0.82352941176470584" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="width" constant="22" id="8gs-Y0-AHF"/>
</constraints>
<state key="normal" title="&gt;"/>
<connections>
<action selector="goForward" destination="S10-Dt-JJr" eventType="touchUpInside" id="bsF-Tk-ENJ"/>
</connections>
</button>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="5Zo-Y6-mA9">
<rect key="frame" x="60" y="20" width="257" height="30"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
<connections>
<outlet property="delegate" destination="OL3-89-hAR" id="QXh-Ud-SU7"/>
</connections>
</textField>
<webView contentMode="scaleToFill" scalesPageToFit="YES" translatesAutoresizingMaskIntoConstraints="NO" id="S10-Dt-JJr">
<rect key="frame" x="0.0" y="54" width="320" height="415"/>
<color key="backgroundColor" red="0.36078431370000003" green="0.38823529410000002" blue="0.4039215686" alpha="1" colorSpace="deviceRGB"/>
<connections>
<outlet property="delegate" destination="OL3-89-hAR" id="BR0-jC-Rzz"/>
</connections>
</webView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="ixb-cc-5YB" firstAttribute="leading" secondItem="nAS-0c-kXL" secondAttribute="leading" id="50B-pd-fEq"/>
<constraint firstItem="3Kp-dS-bR4" firstAttribute="baseline" secondItem="Lvb-Db-aer" secondAttribute="firstBaseline" id="5Rv-lv-juB"/>
<constraint firstItem="5Zo-Y6-mA9" firstAttribute="top" secondItem="7NQ-Aq-zoJ" secondAttribute="bottom" id="6G4-Hr-0wx"/>
<constraint firstAttribute="trailingMargin" secondItem="5Zo-Y6-mA9" secondAttribute="trailing" constant="-13" id="6Ir-an-DEB"/>
<constraint firstItem="Lvb-Db-aer" firstAttribute="leading" secondItem="3Kp-dS-bR4" secondAttribute="trailing" constant="8" symbolic="YES" id="6Y0-jW-Tjb"/>
<constraint firstAttribute="trailing" secondItem="ixb-cc-5YB" secondAttribute="trailing" id="7pv-Eg-dJx"/>
<constraint firstItem="Ftu-sy-5oA" firstAttribute="top" secondItem="ixb-cc-5YB" secondAttribute="bottom" id="7qg-Xp-HYt"/>
<constraint firstItem="S10-Dt-JJr" firstAttribute="top" secondItem="7NQ-Aq-zoJ" secondAttribute="bottom" id="9wF-BU-irC"/>
<constraint firstItem="ixb-cc-5YB" firstAttribute="top" secondItem="S10-Dt-JJr" secondAttribute="bottom" constant="1" id="NuN-Qi-AjC"/>
<constraint firstItem="S10-Dt-JJr" firstAttribute="leading" secondItem="nAS-0c-kXL" secondAttribute="leading" id="Tze-Ns-MRN"/>
<constraint firstItem="S10-Dt-JJr" firstAttribute="top" secondItem="3Kp-dS-bR4" secondAttribute="bottom" constant="8" symbolic="YES" id="A8u-hP-2x1"/>
<constraint firstItem="5Zo-Y6-mA9" firstAttribute="leading" secondItem="Lvb-Db-aer" secondAttribute="trailing" constant="5" id="FRD-Dz-fpG"/>
<constraint firstItem="Lvb-Db-aer" firstAttribute="baseline" secondItem="3Kp-dS-bR4" secondAttribute="firstBaseline" id="K2N-Z5-1ZA"/>
<constraint firstItem="S10-Dt-JJr" firstAttribute="trailing" secondItem="ixb-cc-5YB" secondAttribute="trailing" id="OtD-Nr-4Me"/>
<constraint firstItem="S10-Dt-JJr" firstAttribute="leading" secondItem="ixb-cc-5YB" secondAttribute="leading" id="Q6b-yN-JJz"/>
<constraint firstItem="Ftu-sy-5oA" firstAttribute="top" secondItem="Zgq-zj-adN" secondAttribute="bottom" id="V8X-at-K05"/>
<constraint firstAttribute="trailing" secondItem="S10-Dt-JJr" secondAttribute="trailing" id="cG9-5s-gvC"/>
<constraint firstItem="Lvb-Db-aer" firstAttribute="centerY" secondItem="5Zo-Y6-mA9" secondAttribute="centerY" id="hEo-Zf-3vp"/>
<constraint firstItem="ixb-cc-5YB" firstAttribute="top" secondItem="S10-Dt-JJr" secondAttribute="bottom" constant="1" id="ifv-k8-C0k"/>
<constraint firstAttribute="trailing" secondItem="Zgq-zj-adN" secondAttribute="trailing" id="kgS-5h-tb1"/>
<constraint firstItem="3Kp-dS-bR4" firstAttribute="top" secondItem="Lvb-Db-aer" secondAttribute="top" id="sOh-Ha-BTG"/>
<constraint firstItem="3Kp-dS-bR4" firstAttribute="leading" secondItem="nAS-0c-kXL" secondAttribute="leadingMargin" constant="-13" id="wp0-5c-qRq"/>
</constraints>
</view>
<connections>
<outlet property="textView" destination="ixb-cc-5YB" id="wYO-sm-Buz"/>
<outlet property="url" destination="5Zo-Y6-mA9" id="k5W-AZ-Vhs"/>
<outlet property="webView" destination="S10-Dt-JJr" id="cvN-Gv-jG6"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="E5B-vG-8p2" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="856" y="960"/>
<point key="canvasLocation" x="856" y="1090"/>
</scene>
</scenes>
<resources>

View File

@ -51,10 +51,10 @@
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
</dict>
</plist>

View File

@ -10,12 +10,19 @@
#import "ViewController.h"
#import <UIKit/UIKit.h>
@interface ViewControllerRouteRequest : UIViewController
@interface ViewControllerRouteRequest
: UIViewController <UIWebViewDelegate, UITextFieldDelegate>
#pragma mark - Refrence to other views in app
@property (strong, nonatomic) ViewController *main;
#pragma mark - Things on screen
@property (strong, nonatomic) IBOutlet UIWebView *webView;
@property (strong, nonatomic) IBOutlet UITextView *textView;
@property (strong, nonatomic) IBOutlet UITextField *url;
- (IBAction)ok:(UIButton *)sender;
@end

View File

@ -13,11 +13,43 @@
- (void)viewDidLoad
{
[super viewDidLoad];
[_webView
loadRequest:[NSURLRequest
requestWithURL:
[NSURL URLWithString:@"http://www.vatroute.net"]]];
// Do any additional setup after loading the view.
}
- (IBAction)ok:(UIButton *)sender
{
[self parseRoute];
[self dismissViewControllerAnimated:YES completion:nil];
}
- (void)parseRoute
{
NSArray *route = [_textView.text componentsSeparatedByString:@" "];
}
#pragma mark - Delegate
- (BOOL)webView:(UIWebView *)webView
shouldStartLoadWithRequest:(NSURLRequest *)request
navigationType:(UIWebViewNavigationType)navigationType
{
NSURL *url = [request URL];
_url.text = [url absoluteString];
return YES;
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
[textField resignFirstResponder];
[_webView loadRequest:[NSURLRequest
requestWithURL:[NSURL URLWithString:_url.text]]];
return YES;
}
@end