swift3

Swift 3.0 - Drawing on imageView with finger

浪子不回头ぞ 提交于 2019-12-21 06:08:00
问题 I have been working on being able to draw a red line on an image view using swift 3.0 and have ran across some problems. As you could guess, I am using some code from stack overflow to help me with my first initial attempt at this and am getting a weird bug. As I drag my finger across the imageview it does draw a red line but for each "frame" it drops all that I drew down further on the screen. So as I draw it looks like the lines I am drawing are falling and then just completely go off

Swift 3.0 - Drawing on imageView with finger

你离开我真会死。 提交于 2019-12-21 06:07:26
问题 I have been working on being able to draw a red line on an image view using swift 3.0 and have ran across some problems. As you could guess, I am using some code from stack overflow to help me with my first initial attempt at this and am getting a weird bug. As I drag my finger across the imageview it does draw a red line but for each "frame" it drops all that I drew down further on the screen. So as I draw it looks like the lines I am drawing are falling and then just completely go off

How to update value in Firebase with childByAutoId?

守給你的承諾、 提交于 2019-12-21 06:04:56
问题 When I create objects in Firebase, I use childByAutoId. How can I update these specific objects later? I'm having trouble obtaining the value of the key Firebase automatically updates. Snapshot.key just returns "users". Here's my JSON structure: { "users" : { "-KQaU9lVcUYzIo52LgmN" : { "device" : "e456f740-023e-440a" "name: "Test" } }, How can I get the -KQaU9lVcUYzIo52LgmN key? I want to update the device child. Here's what I have so far. It currently creates a completely separate snapshot

How To get values of textfields from a UITableViewCell?

ⅰ亾dé卋堺 提交于 2019-12-21 05:38:11
问题 So I have this UITableView cell that has 4 UITextField , and I want to get their values on button click. This code does not retrieve any values. @IBAction func printBtnAction(_ sender: Any) { let cell = self.myTableView.dequeueReusableCell(withIdentifier: "manualAddC1") as! AddFriendC1Cell let alias = cell.aliasTextField.text! let primaryPhone = cell.primaryPhoneTextField.text! let secondaryPhone = cell.seondaryPhoneTextField.text! let email = cell.emailAddressTextField.text! print("Alias: \

Firebase - permission denied when fetching users

雨燕双飞 提交于 2019-12-21 05:28:13
问题 I'm trying to fetch users from a Firebase database with this code but I get this error cancel error Error Domain=com.firebase Code=1 "Permission Denied" UserInfo={NSLocalizedDescription=Permission Denied} How should my rules be set up? Here's the code: FIRDatabase.database().reference().child("users").observe(.childAdded, with: { (snapshot) in print("snapshot \(snapshot)") //all users right here n shyt if let dictionary = snapshot.value as? [String: AnyObject] { let user = User() //class

How to make a bullet list with Swift?

旧城冷巷雨未停 提交于 2019-12-21 04:59:08
问题 So I want to make something like this using swift and xcode: Where I get each dot from an array. What I have thought is to make a UILabel and make a for loop that iterates over the array and in each iteration it adds to the label \u{2022} + content. I know \u{2022} is the dot point in unicode, the problem is that I need a way to make the list divided in two columns as shown and to make the dot point color yellow. This cant be done if I add the dots programmatically as I described above

How to check if IndexPath is valid?

时光怂恿深爱的人放手 提交于 2019-12-21 04:50:06
问题 Prior to swift 3, i used to use for example: let path = self.tableView.indexPathForSelectedRow if (path != NSNotFound) { //do something } But now, since i use IndexPath class in swift3, i'm looking for the equivalent for the path != NSNotFound check. Xcode8.3.1 compiler error: "Binary operator '!=' cannot be applied to operands of type 'IndexPath' and 'Int'" 回答1: Semantically, to consider an indexPath invalid , you need something to check for such as a table view or a collection view. Usually

swift 3 using speech recognition and AVFoundation together

自闭症网瘾萝莉.ら 提交于 2019-12-21 04:17:07
问题 I am successfully able to use Speech (speech recognition) and I can use AVFoundation to play wav files in Xcode 8/IOS 10. I just can't use them both together. I have working speech recognition code where I import Speech. When I import AVFoundation into the same app and use the following code, there is no sound and no errors are generated: var audioPlayer: AVAudioPlayer! func playAudio() { let path = Bundle.main.path(forResource: "file.wav", ofType: nil)! let url = URL(fileURLWithPath: path)

swift 3 using speech recognition and AVFoundation together

百般思念 提交于 2019-12-21 04:17:01
问题 I am successfully able to use Speech (speech recognition) and I can use AVFoundation to play wav files in Xcode 8/IOS 10. I just can't use them both together. I have working speech recognition code where I import Speech. When I import AVFoundation into the same app and use the following code, there is no sound and no errors are generated: var audioPlayer: AVAudioPlayer! func playAudio() { let path = Bundle.main.path(forResource: "file.wav", ofType: nil)! let url = URL(fileURLWithPath: path)

How to make UISlider default thumb to be smaller like the ones in the iOS control center

女生的网名这么多〃 提交于 2019-12-21 04:10:55
问题 I'm working on an app and I have a custom UISlider . However, I'm having some issues on how to make the default thumb to appear smaller like the ones in the iOS control center. Note that I want the same iOS thumb, not a custom thumb image. So far, I've tried thumbRect(forBounds...) but no luck. Any suggestions? 回答1: You can't change the size of the default thumb image, but UISlider has a method setThumbImage(_:for:) that will allow you to pass a similar, smaller image. In your view controller