From d9e770abaaa13e46ebc2f190885e0076213a7cfd Mon Sep 17 00:00:00 2001 From: kosyloa Date: Thu, 25 Apr 2024 17:03:45 +0200 Subject: [PATCH] add info button --- .../QuoteTableApp/Base.lproj/Main.storyboard | 48 +++++++++++++++++-- .../QuoteTableViewController.swift | 14 ++++++ 2 files changed, 58 insertions(+), 4 deletions(-) diff --git a/Samples/QuoteTableApp/Base.lproj/Main.storyboard b/Samples/QuoteTableApp/Base.lproj/Main.storyboard index f9c6c365b..eb5acf6ea 100644 --- a/Samples/QuoteTableApp/Base.lproj/Main.storyboard +++ b/Samples/QuoteTableApp/Base.lproj/Main.storyboard @@ -35,9 +35,16 @@ - - + + + @@ -128,14 +135,41 @@ + + + + + + + + + + + + + + - + + + + @@ -152,12 +186,13 @@ + - + @@ -359,11 +394,16 @@ + + + + + diff --git a/Samples/QuoteTableApp/QuoteTableViewController.swift b/Samples/QuoteTableApp/QuoteTableViewController.swift index 3881b4fd3..0abf7c2ef 100644 --- a/Samples/QuoteTableApp/QuoteTableViewController.swift +++ b/Samples/QuoteTableApp/QuoteTableViewController.swift @@ -20,6 +20,7 @@ class QuoteTableViewController: UIViewController { @IBOutlet var agregationSwitch: UISwitch! @IBOutlet var titleLabel: UILabel! @IBOutlet var addButton: UIButton! + @IBOutlet var noticeButton: UIButton! override func viewDidLoad() { super.viewDidLoad() @@ -28,6 +29,9 @@ class QuoteTableViewController: UIViewController { self.quoteTableView.backgroundColor = .clear quoteTableView.separatorStyle = .none + + noticeButton.setTitle("Learn more about dxFeed APIs", for: .normal) + noticeButton.titleEdgeInsets = UIEdgeInsets(top: 0, left: 8, bottom: 0, right: 0) NotificationCenter.default.addObserver(forName: .selectedSymbolsChanged, object: nil, @@ -89,6 +93,16 @@ class QuoteTableViewController: UIViewController { @IBAction func changeAggregationPeriod(_ sender: UISwitch) { subscribe(agregationSwitch.isOn) } + + @IBAction func openNews(_ sender: UIButton) { + let url = URL(string: "https://dxfeed.com/dxfeed-news/")! + if #available(iOS 10.0, *) { + UIApplication.shared.open(url, options: [:], completionHandler: nil) + } else { + // Fallback on earlier versions + UIApplication.shared.openURL(url) + } + } } extension QuoteTableViewController: DXEndpointListener {