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

Adds autolayout rules to adapt the UIView more accurately #59

Merged
merged 1 commit into from
Apr 23, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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