소스 검색

add UIView extension to position a view to the trailing of another view

cyberta 6 년 전
부모
커밋
d78e7e7b64
2개의 변경된 파일21개의 추가작업 그리고 0개의 파일을 삭제
  1. 9 0
      deltachat-ios/Handler/QRCodeHandler.swift
  2. 12 0
      deltachat-ios/Helper/UIView+Extension.swift

+ 9 - 0
deltachat-ios/Handler/QRCodeHandler.swift

@@ -0,0 +1,9 @@
+//
+//  QRCodeHandler.swift
+//  deltachat-ios
+//
+//  Created by Macci on 06.08.19.
+//  Copyright © 2019 Jonas Reinsch. All rights reserved.
+//
+
+import Foundation

+ 12 - 0
deltachat-ios/Helper/UIView+Extension.swift

@@ -73,6 +73,18 @@ extension UIView {
 			constant: paddingTop)
 	}
 
+	func constraintToTrailingOf(_ view: UIView, paddingLeading: CGFloat = 0.0) -> NSLayoutConstraint {
+		return NSLayoutConstraint(
+			item: self,
+			attribute: .leading,
+			relatedBy: .equal,
+			toItem: view,
+			attribute: .trailing,
+			multiplier: 1.0,
+			constant: paddingLeading)
+	}
+
+
 	func constraintCenterXTo(_ view: UIView, paddingX: CGFloat = 0.0) -> NSLayoutConstraint {
 		return NSLayoutConstraint(item: self,
 								  attribute: .centerX,