OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #import <UIKit/UIKit.h> |
| 6 |
| 7 #include "ios/chrome/share_extension/ui_util.h" |
| 8 |
| 9 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 10 #error "This file requires ARC support." |
| 11 #endif |
| 12 |
| 13 namespace ui_util { |
| 14 |
| 15 CGFloat AlignValueToPixel(CGFloat value) { |
| 16 CGFloat scale = [[UIScreen mainScreen] scale]; |
| 17 return floor(value * scale) / scale; |
| 18 } |
| 19 |
| 20 void ConstrainAllSidesOfViewToView(UIView* container, UIView* filler) { |
| 21 [NSLayoutConstraint activateConstraints:@[ |
| 22 [filler.leadingAnchor constraintEqualToAnchor:container.leadingAnchor], |
| 23 [filler.trailingAnchor constraintEqualToAnchor:container.trailingAnchor], |
| 24 [filler.topAnchor constraintEqualToAnchor:container.topAnchor], |
| 25 [filler.bottomAnchor constraintEqualToAnchor:container.bottomAnchor], |
| 26 ]]; |
| 27 } |
| 28 |
| 29 } // namespace ui_util |
OLD | NEW |