From 856885f7d0bc5afee603a40161e747c1c0a2686b Mon Sep 17 00:00:00 2001 From: AppFeel Date: Wed, 24 Jun 2015 09:04:15 +0200 Subject: [PATCH] Add resize method --- src/ios/OverAppBrowser.m | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/ios/OverAppBrowser.m b/src/ios/OverAppBrowser.m index d2bb7e8..3bd24c9 100755 --- a/src/ios/OverAppBrowser.m +++ b/src/ios/OverAppBrowser.m @@ -100,6 +100,39 @@ - (void)fade:(CDVInvokedUrlCommand *)command { [UIView commitAnimations]; } +- (void)resize:(CDVInvokedUrlCommand *)command { + NSArray* arguments = [command arguments]; + + self.callbackId = command.callbackId; + NSUInteger argc = [arguments count]; + + if (argc < 4) { // at a minimum we need x origin, y origin and width... + return; + } + + if (self.overWebView != NULL) { + return;//already created, don't need to create it again + } + + CGFloat originx,originy,width; + CGFloat height = 30; + originx = [[arguments objectAtIndex:1] floatValue]; + originy = [[arguments objectAtIndex:2] floatValue]; + width = [[arguments objectAtIndex:3] floatValue]; + if (argc > 3) { + height = [[arguments objectAtIndex:4] floatValue]; + } + + CGRect viewRect = CGRectMake( + originx, + originy, + width, + height + ); + + self.overWebView.frame = viewRect; +} + - (BOOL)isValidCallbackId:(NSString *)callbackId { NSError *err = nil;