Skip to content
This repository has been archived by the owner on Apr 28, 2022. It is now read-only.

Commit

Permalink
Merge pull request YousicianGit#59 from YousicianGit/fix/FixesEditVie…
Browse files Browse the repository at this point in the history
…wAutolayout

Adds autolayout rules to adapt the UIView more accurately
  • Loading branch information
daniel-ys authored Apr 23, 2018
2 parents 477f2bb + 6c179ca commit 107dca8
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions release/NativeEditPlugin/Plugins/iOS/EditBox_iOS.m
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,22 @@ +(void) initializeEditBox:(UIViewController*) _unityViewController unityName:(c
dictEditBox = [[NSMutableDictionary alloc] init];

CGRect frameView = unityViewController.view.frame;
frameView.origin = CGPointMake(0.0f, 0.0f);
viewPlugin = [[EditBoxHoldView alloc] initHoldView:frameView];
[unityViewController.view addSubview:viewPlugin];
[viewPlugin setTranslatesAutoresizingMaskIntoConstraints:NO];
[[unityViewController view] addSubview:viewPlugin];

NSArray *attributes = @[@(NSLayoutAttributeLeft), @(NSLayoutAttributeTop), @(NSLayoutAttributeRight), @(NSLayoutAttributeBottom)];
NSMutableArray *constraints = [NSMutableArray array];
[attributes enumerateObjectsUsingBlock:^(id _Nonnull attribute, NSUInteger idx, BOOL * _Nonnull stop) {
[constraints addObject:[NSLayoutConstraint constraintWithItem:viewPlugin
attribute:[attribute integerValue]
relatedBy:NSLayoutRelationEqual
toItem:[viewPlugin superview]
attribute:[attribute integerValue]
multiplier:1.0f
constant:0.0f]];
}];
[NSLayoutConstraint activateConstraints:constraints];

strcpy(g_unityName, unityName);
}
Expand Down

0 comments on commit 107dca8

Please sign in to comment.