swift4

add download button for pdf in wkwebview in swift 4

喜欢而已 提交于 2021-02-07 13:41:26
问题 I have done webview app using wkwebiew in xcode 9. In the website, there are some part need to download the pdf file, the pdf file can be view only but how to make it can be download to our iphone. can you share some tip to me, this is my code class ViewController: UIViewController,WKNavigationDelegate,UIWebViewDelegate { @IBOutlet weak var activityIndicator: UIActivityIndicatorView! @IBOutlet weak var webView: WKWebView! @IBOutlet var containerView: UIView? = nil @IBOutlet weak var

add download button for pdf in wkwebview in swift 4

好久不见. 提交于 2021-02-07 13:38:23
问题 I have done webview app using wkwebiew in xcode 9. In the website, there are some part need to download the pdf file, the pdf file can be view only but how to make it can be download to our iphone. can you share some tip to me, this is my code class ViewController: UIViewController,WKNavigationDelegate,UIWebViewDelegate { @IBOutlet weak var activityIndicator: UIActivityIndicatorView! @IBOutlet weak var webView: WKWebView! @IBOutlet var containerView: UIView? = nil @IBOutlet weak var

How to get the today's and tomorrow's date in swift 4

走远了吗. 提交于 2021-02-07 10:24:25
问题 How to get the current date in unix-epoch ? timeIntervalSince1970 prints the current time. Is there any way to get today's time at 12 AM? For example, The current time is : Jan 7, 2018 5:30 PM. timeIntervalSince1970 will print the current time i.e. 1546903800000 . Current date in epoch system will be Jan 7, 2018 00:00 AM. i.e 1546848000000 回答1: I would do this with components. Assuming you need time in seconds as defined by time(2). If you need in milliseconds as defined by time(3), then you

How to get the today's and tomorrow's date in swift 4

自作多情 提交于 2021-02-07 10:22:27
问题 How to get the current date in unix-epoch ? timeIntervalSince1970 prints the current time. Is there any way to get today's time at 12 AM? For example, The current time is : Jan 7, 2018 5:30 PM. timeIntervalSince1970 will print the current time i.e. 1546903800000 . Current date in epoch system will be Jan 7, 2018 00:00 AM. i.e 1546848000000 回答1: I would do this with components. Assuming you need time in seconds as defined by time(2). If you need in milliseconds as defined by time(3), then you

SelectedTintColor of Segment Control is not rounded corner on iOS 13

China☆狼群 提交于 2021-02-06 09:25:08
问题 Rounded corner is working great on iOS 12 and below, but it's broken on iOS 13. I've created a custom Segment control class. Code: class SegmentedControl: UISegmentedControl { override func layoutSubviews() { super.layoutSubviews() layer.cornerRadius = self.bounds.size.height / 2.0 layer.borderColor = UIColor(red: 170.0/255.0, green: 170.0/255.0, blue: 170.0/255.0, alpha: 1.0).cgColor layer.borderWidth = 1.0 layer.masksToBounds = true clipsToBounds = true } } I've gone through this post - How

SelectedTintColor of Segment Control is not rounded corner on iOS 13

家住魔仙堡 提交于 2021-02-06 09:22:50
问题 Rounded corner is working great on iOS 12 and below, but it's broken on iOS 13. I've created a custom Segment control class. Code: class SegmentedControl: UISegmentedControl { override func layoutSubviews() { super.layoutSubviews() layer.cornerRadius = self.bounds.size.height / 2.0 layer.borderColor = UIColor(red: 170.0/255.0, green: 170.0/255.0, blue: 170.0/255.0, alpha: 1.0).cgColor layer.borderWidth = 1.0 layer.masksToBounds = true clipsToBounds = true } } I've gone through this post - How

How to implement iOS 11's MKUserTrackingButton

╄→гoц情女王★ 提交于 2021-02-04 04:56:56
问题 I'm trying to implement a MKUserTrackingButton (which is new in iOS 11 SDK). This "button" actually inherits from UIView so I just put a UIView instance on my Map and in the Identity Inspector, linked it to the MKUserTrackingButton class, added an outlet in my code and in viewDidLoad(). I initialize it the following way: self.centerMapButton = MKUserTrackingButton.init(mapView: self.mapView) However, nothing works, I just have a blank view on my Map. PS: Here's the WWDC 2017 session about

Using Swift 5 Libraries in a Swift 4 Project

本小妞迷上赌 提交于 2021-01-29 13:09:30
问题 I am using Swift 4 version in my current project. However, the Swift version of Cocoapods library is 5. I can't downgrade the library because the latest version of the library has the features I want. In addition, there are a lot of difficulties in raising the version of the project immediately. I'm trying to modify the code in a library after installing the latest version of the library. But the workload is very heavy. Is there a good way?? Help me.. 回答1: Try setting the pod swift version

Code not executing after .observe firebase method swift4

[亡魂溺海] 提交于 2021-01-29 09:33:42
问题 I have a structure in which users are registering for events, and the registered events are stored as the following: I am trying to access the registeredEvents and display the children on a table view. So far, I have done this: override func viewDidLoad() { super.viewDidLoad() let id = Auth.auth().currentUser?.uid let ref = Database.database().reference() ref.child("users").child(id!).child("registeredEvents").observeSingleEvent(of: .value, with: { snapshot in print(snapshot.childrenCount)

How to hide passwords in a UITextField like “*****”?

青春壹個敷衍的年華 提交于 2021-01-28 10:44:54
问题 How to hide passwords in a UITextField like "*****" ? To hide password, i used following code txtPassword.isSecureTextEntry = true but this will display like “•••••••” , but i need like "*******" 回答1: To achieve the same, you can use a normal textfield without the secure input option. When a user enters a character, save it to a string variable, and replace it in the textfield with the character you wish to present instead of the bullets. Set the textField delegate in viewDidLoad() as: