Use top, left, width, height instead of bounds
This commit is contained in:
parent
6c91c1ac68
commit
96a88759c5
@ -148,8 +148,7 @@
|
|||||||
|
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
|
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
|
||||||
NSArray* bounds = settings[@"ui"][@"bounds"];
|
CGRect rect = [self rectFromDictionary:settings[@"ui"]];
|
||||||
CGRect rect = [self convertIntoRect:bounds];
|
|
||||||
|
|
||||||
[controller presentFromRect:rect
|
[controller presentFromRect:rect
|
||||||
inView:self.webView
|
inView:self.webView
|
||||||
@ -281,8 +280,7 @@
|
|||||||
withSettings:(NSDictionary *)settings
|
withSettings:(NSDictionary *)settings
|
||||||
{
|
{
|
||||||
NSString* callbackId = settings[@"callbackId"];
|
NSString* callbackId = settings[@"callbackId"];
|
||||||
NSArray* bounds = settings[@"ui"][@"bounds"];
|
CGRect rect = [self rectFromDictionary:settings[@"ui"]];
|
||||||
CGRect rect = [self convertIntoRect:bounds];
|
|
||||||
|
|
||||||
UIPrintInteractionCompletionHandler handler =
|
UIPrintInteractionCompletionHandler handler =
|
||||||
^(UIPrintInteractionController *ctrl, BOOL ok, NSError *e) {
|
^(UIPrintInteractionController *ctrl, BOOL ok, NSError *e) {
|
||||||
@ -352,16 +350,19 @@
|
|||||||
*
|
*
|
||||||
* @return A converted Rect object
|
* @return A converted Rect object
|
||||||
*/
|
*/
|
||||||
- (CGRect) convertIntoRect:(NSArray*)bounds
|
- (CGRect) rectFromDictionary:(NSDictionary *)pos
|
||||||
{
|
{
|
||||||
if (!bounds) {
|
CGFloat left = 40, top = 30, width = 0, height = 0;
|
||||||
bounds = @[@40, @30, @0, @0];
|
|
||||||
|
if (pos)
|
||||||
|
{
|
||||||
|
top = [pos[@"top"] floatValue];
|
||||||
|
left = [pos[@"left"] floatValue];
|
||||||
|
width = [pos[@"width"] floatValue];
|
||||||
|
height = [pos[@"height"] floatValue];
|
||||||
}
|
}
|
||||||
|
|
||||||
return CGRectMake([bounds[0] floatValue],
|
return CGRectMake(left, top, width, height);
|
||||||
[bounds[1] floatValue],
|
|
||||||
[bounds[2] floatValue],
|
|
||||||
[bounds[3] floatValue]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user