From 99b05d2c7fae417b847937b4351b02bbd489436a Mon Sep 17 00:00:00 2001 From: Kilian Hofmann Date: Mon, 18 Apr 2016 13:20:07 +0200 Subject: [PATCH] WebPage loading --- .../xcdebugger/Breakpoints_v2.xcbkptlist | 34 +++++++++ FMC Planner 2.xcodeproj/project.pbxproj | 4 +- FMC Planner 2/Base.lproj/Main.storyboard | 69 ++++++++++++++++--- FMC Planner 2/Info.plist | 10 +-- FMC Planner 2/ViewControllerRouteRequest.h | 9 ++- FMC Planner 2/ViewControllerRouteRequest.m | 32 +++++++++ 6 files changed, 141 insertions(+), 17 deletions(-) diff --git a/FMC PLanner 2.xcworkspace/xcuserdata/Kili2.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/FMC PLanner 2.xcworkspace/xcuserdata/Kili2.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index ed9a9b4..0b22756 100644 --- a/FMC PLanner 2.xcworkspace/xcuserdata/Kili2.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/FMC PLanner 2.xcworkspace/xcuserdata/Kili2.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -2,4 +2,38 @@ + + + + + + + + + + diff --git a/FMC Planner 2.xcodeproj/project.pbxproj b/FMC Planner 2.xcodeproj/project.pbxproj index db1fb98..d1be884 100644 --- a/FMC Planner 2.xcodeproj/project.pbxproj +++ b/FMC Planner 2.xcodeproj/project.pbxproj @@ -203,8 +203,6 @@ E2A9270E1CA2FE5200606E07 /* Header */, E22EE9DB1C9DB7B3001F5BC0 /* Assets.xcassets */, E22EE9E01C9DB7B3001F5BC0 /* Info.plist */, - E20D7B4E1CBE807700FF3C70 /* NavDataParser.h */, - E20D7B4F1CBE807700FF3C70 /* NavDataParser.m */, ); name = "Supporting Files"; sourceTree = ""; @@ -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; diff --git a/FMC Planner 2/Base.lproj/Main.storyboard b/FMC Planner 2/Base.lproj/Main.storyboard index e258704..e9d0a48 100644 --- a/FMC Planner 2/Base.lproj/Main.storyboard +++ b/FMC Planner 2/Base.lproj/Main.storyboard @@ -3,6 +3,9 @@ + + + @@ -1075,10 +1078,6 @@ - - - - @@ -1099,24 +1098,76 @@ + + + + + + + + + + + + + + + + + + + + + - - - + + + + + - + + + + + + + + + - + diff --git a/FMC Planner 2/Info.plist b/FMC Planner 2/Info.plist index f88c437..fbcc495 100644 --- a/FMC Planner 2/Info.plist +++ b/FMC Planner 2/Info.plist @@ -51,10 +51,10 @@ UIInterfaceOrientationPortrait - UISupportedInterfaceOrientations~ipad - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - + NSAppTransportSecurity + + NSAllowsArbitraryLoads + + diff --git a/FMC Planner 2/ViewControllerRouteRequest.h b/FMC Planner 2/ViewControllerRouteRequest.h index 30db0d7..6fada20 100644 --- a/FMC Planner 2/ViewControllerRouteRequest.h +++ b/FMC Planner 2/ViewControllerRouteRequest.h @@ -10,12 +10,19 @@ #import "ViewController.h" #import -@interface ViewControllerRouteRequest : UIViewController +@interface ViewControllerRouteRequest + : UIViewController #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 diff --git a/FMC Planner 2/ViewControllerRouteRequest.m b/FMC Planner 2/ViewControllerRouteRequest.m index d8520a8..775f55c 100644 --- a/FMC Planner 2/ViewControllerRouteRequest.m +++ b/FMC Planner 2/ViewControllerRouteRequest.m @@ -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