Patch a few small autolayout bugs - not a huge fan of the clone() in constraints but fine for now
This commit is contained in:
parent
86980d7329
commit
3a89d8e5f5
|
@ -27,7 +27,7 @@ impl LayoutAnchorX {
|
||||||
pub fn constraint_equal_to(&self, anchor_to: &LayoutAnchorX) -> LayoutConstraint {
|
pub fn constraint_equal_to(&self, anchor_to: &LayoutAnchorX) -> LayoutConstraint {
|
||||||
match (&self.0, &anchor_to.0) {
|
match (&self.0, &anchor_to.0) {
|
||||||
(Some(from), Some(to)) => LayoutConstraint::new(unsafe {
|
(Some(from), Some(to)) => LayoutConstraint::new(unsafe {
|
||||||
msg_send![*from, constraintEqualToAnchor:&*to]
|
msg_send![*from, constraintEqualToAnchor:&*to.clone()]
|
||||||
}),
|
}),
|
||||||
|
|
||||||
_ => { panic!("Attempted to create horizontal constraints with an uninitialized anchor!"); }
|
_ => { panic!("Attempted to create horizontal constraints with an uninitialized anchor!"); }
|
||||||
|
|
|
@ -27,7 +27,8 @@ impl LayoutAnchorY {
|
||||||
pub fn constraint_equal_to(&self, anchor_to: &LayoutAnchorY) -> LayoutConstraint {
|
pub fn constraint_equal_to(&self, anchor_to: &LayoutAnchorY) -> LayoutConstraint {
|
||||||
match (&self.0, &anchor_to.0) {
|
match (&self.0, &anchor_to.0) {
|
||||||
(Some(from), Some(to)) => LayoutConstraint::new(unsafe {
|
(Some(from), Some(to)) => LayoutConstraint::new(unsafe {
|
||||||
msg_send![*from, constraintEqualToAnchor:&*to]
|
let b: id = msg_send![*from, constraintEqualToAnchor:&*to.clone()];
|
||||||
|
b
|
||||||
}),
|
}),
|
||||||
|
|
||||||
_ => { panic!("Attempted to create vertical constraints with an uninitialized anchor!"); }
|
_ => { panic!("Attempted to create vertical constraints with an uninitialized anchor!"); }
|
||||||
|
|
|
@ -162,6 +162,22 @@ impl<T> View<T> where T: ViewController + 'static {
|
||||||
self.objc_controller.register_for_dragged_types(types);
|
self.objc_controller.register_for_dragged_types(types);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn top(&self) -> &LayoutAnchorY {
|
||||||
|
&self.objc_controller.top
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn leading(&self) -> &LayoutAnchorX {
|
||||||
|
&self.objc_controller.leading
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn trailing(&self) -> &LayoutAnchorX {
|
||||||
|
&self.objc_controller.trailing
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn bottom(&self) -> &LayoutAnchorY {
|
||||||
|
&self.objc_controller.bottom
|
||||||
|
}
|
||||||
|
|
||||||
pub fn width(&self) -> &LayoutAnchorDimension {
|
pub fn width(&self) -> &LayoutAnchorDimension {
|
||||||
&self.objc_controller.width
|
&self.objc_controller.width
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue