Skip to content

Commit

Permalink
Add button in example app to reload webview, to show that reloading t…
Browse files Browse the repository at this point in the history
…he webview works. (See gh issue marcuswestin#94)
  • Loading branch information
marcuswestin committed Aug 1, 2014
1 parent 65c5187 commit 0589180
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions Example Apps/ExampleApp-iOS/ExampleAppViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,29 @@ - (void)webViewDidFinishLoad:(UIWebView *)webView {
}

- (void)renderButtons:(UIWebView*)webView {
UIFont* font = [UIFont fontWithName:@"HelveticaNeue" size:12.0];

UIButton *messageButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[messageButton setTitle:@"Send message" forState:UIControlStateNormal];
[messageButton addTarget:self action:@selector(sendMessage:) forControlEvents:UIControlEventTouchUpInside];
[self.view insertSubview:messageButton aboveSubview:webView];
messageButton.frame = CGRectMake(20, 414, 130, 45);

messageButton.frame = CGRectMake(10, 414, 100, 35);
messageButton.titleLabel.font = font;
messageButton.backgroundColor = [UIColor colorWithWhite:1 alpha:0.75];

UIButton *callbackButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[callbackButton setTitle:@"Call handler" forState:UIControlStateNormal];
[callbackButton addTarget:self action:@selector(callHandler:) forControlEvents:UIControlEventTouchUpInside];
[self.view insertSubview:callbackButton aboveSubview:webView];
callbackButton.frame = CGRectMake(170, 414, 130, 45);
callbackButton.frame = CGRectMake(110, 414, 100, 35);
callbackButton.titleLabel.font = font;

UIButton* reloadButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[reloadButton setTitle:@"Reload webview" forState:UIControlStateNormal];
[reloadButton addTarget:webView action:@selector(reload) forControlEvents:UIControlEventTouchUpInside];
[self.view insertSubview:reloadButton aboveSubview:webView];
reloadButton.frame = CGRectMake(210, 414, 100, 35);
reloadButton.titleLabel.font = font;
}

- (void)sendMessage:(id)sender {
Expand Down

0 comments on commit 0589180

Please sign in to comment.