Set sourceView sourceRect to transaction items

pull/2/head
Michael Scoff 7 years ago
parent 961be0fb98
commit 65add7cba5
  1. 9
      Trust/Transactions/ViewControllers/TransactionViewController.swift
  2. 4
      Trust/UI/Form/TransactionAppearance.swift

@ -63,11 +63,11 @@ class TransactionViewController: UIViewController {
}
private func item(title: String, value: String) -> UIView {
return TransactionAppearance.item(
return TransactionAppearance.item(
title: title,
subTitle: value
) { [weak self] in
self?.showAlertSheet(title: $0, value: $1)
self?.showAlertSheet(title: $0, value: $1, sourceView: $2)
}
}
@ -87,13 +87,14 @@ class TransactionViewController: UIViewController {
return stackView
}
func showAlertSheet(title: String, value: String) {
func showAlertSheet(title: String, value: String, sourceView: UIView) {
let alertController = UIAlertController(
title: nil,
message: value,
preferredStyle: .actionSheet
)
alertController.popoverPresentationController?.sourceView = self.view
alertController.popoverPresentationController?.sourceView = sourceView
alertController.popoverPresentationController?.sourceRect = sourceView.bounds
let copyAction = UIAlertAction(title: NSLocalizedString("transactionDetails.copy", value: "Copy", comment: ""), style: .default) { _ in
UIPasteboard.general.string = value
}

@ -19,7 +19,7 @@ struct TransactionAppearance {
return view
}
static func item(title: String, subTitle: String, completion:((_ title: String, _ value: String) -> Void)? = .none) -> UIView {
static func item(title: String, subTitle: String, completion:((_ title: String, _ value: String, _ sender: UIView) -> Void)? = .none) -> UIView {
let titleLabel = UILabel(frame: .zero)
titleLabel.translatesAutoresizingMaskIntoConstraints = false
titleLabel.text = title
@ -42,7 +42,7 @@ struct TransactionAppearance {
stackView.isLayoutMarginsRelativeArrangement = true
UITapGestureRecognizer(addToView: stackView) {
completion?(title, subTitle)
completion?(title, subTitle, stackView)
}
return stackView

Loading…
Cancel
Save