xcode

swift: button.isUserInteractionEnabled = false stops working when scrolling tableview

北战南征 提交于 2021-01-29 13:45:33
问题 I am using a tableview where the first cell contains two buttons. When the first button is activated, the second should be disabled (you should not be able to press it). It all works fine until I start scrolling down the tableview. If I scroll down as far as possible while still being able to see the buttons in first cell, and I activate the first button, I am still able to press the other one. Other things also stops working, but I guess that it is cause by the same thing. Do you have any

Executing Javascript Code From Objective C

北慕城南 提交于 2021-01-29 13:39:29
问题 I have some javascript code that I need to execute from an objective-c (iPhone) app. The javascript code needs some of the values from the iPhone app. What I mean is, there is a spot in the iPhone app (a textbox ) for a user to type their name. Then the javascript code that runs will be: alert(name) where the name variable is really textbox.text How can I do this from objective-c, without relying on an external webserver? Thank you! 回答1: Add a UIWebView and inject a <script> tag containing

SwiftUI Picker with Cloud Firestore

跟風遠走 提交于 2021-01-29 13:36:55
问题 I was wondering whether I was able to get some help on this one, I've been trying a while to get things working and functioning properly and have been able to pass the Firestore data into the picker view, but I'm unable to select the data to view in the 'selected' area. I have added my code and my Firestore setup. Thanks in advance. import SwiftUI import Firebase struct SchoolDetailsView: View { @ObservedObject var schoolData = getSchoolData() @State var selectedSchool: String! var body: some

Xcode SpriteKit Game - How to configure the UI for multiple screen sizes during App install

狂风中的少年 提交于 2021-01-29 12:54:50
问题 I'm developing a basic game for IOS using SpriteKit. iPhone devices come in many shapes and colours. The former of which is giving me a bit of a headache. Different sized screens. This is a two part question. Firstly What solutions have other people implemented to achieve a uniform layout over multiple display sizes? The current solution I'm looking at adopting is to find the device type as suggested in one of the solutions here Scale sprite kit game for all devices, I'll be implementing this

How to solve UICollectionViewFlowLayoutBreakForInvalidSizes

时间秒杀一切 提交于 2021-01-29 12:24:17
问题 I couldn't find an answer to this problem maybe because my code is different I don't know but in the end, I didn't found an answer, collectionView keep complaining about UICollectionViewFlowLayoutBreakForInvalidSizes and wants me to catch the err with symbolic breakpoint but I even with the breakpoint debugger not showing any information about the err, here is how I'm implementing collectionView if anyone could find the problem in my code please let me know The relevant

Undefined symbols for architecture x86_64: “_OBJC_CLASS_$_GNSMessageManager” - NearBy native development for iOS in flutter app

橙三吉。 提交于 2021-01-29 12:23:42
问题 Just trying to build nearby natively in flutter app throws error Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_GNSMessageManager", referenced from: objc-class-ref in AppDelegate.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) I tried to change build setting architecture and build phase linked binary with library as well but nothing worked for me. Info.plist file <?xml version="1.0" encoding="UTF-8"?>

Swift app's audio don't match the brightness intensity of the image section randomly?

∥☆過路亽.° 提交于 2021-01-29 12:02:28
问题 I have this application that takes an image (under OpenCVWrapper) that is grayscale and turns the brightness of that specific section that's touched by the Apple Pencil into sound. The dark areas don't make any sound, the medium areas make a medium pitch, and the bright areas make a high pitch. But for some reason the code works in some areas of the image flawlessly and in other it's almost reversed. Code Below: //Produce Sound Based on Location of Touch Input @objc func strokeAction(gesture:

How to position CAShapeLayer in a UIView

折月煮酒 提交于 2021-01-29 11:46:40
问题 I saw many answers on Stack overflow, but none helped me. I created a DrawView where it's possible to draw. I created an instance of UIBezierPath for drawing. I want to transfer my drawing on a little view (the red one on the image). That's what I did: // This function is called when the user has finished to draw. override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) { let shapeLayer = CAShapeLayer() //The CAShapeLayer has the same path of the drawing (currentPath is the

Why won't text on a label show up on an actual device but will in the simulator? (Xcode)

大憨熊 提交于 2021-01-29 11:25:53
问题 Running : - Latest version of Xcode - Catalina 10.15.2 - Base model MacBook Pro 13 inch I'm having an issue where when I have text in a label show up on the simulator but when I try running it on my iPad, it is just blank. The text is currently being shown on the simulator because that is what I have just typed in on the label on the main.storyboard. I have tried setting the label text manually by doing myLabel.text = "myText" but that didn't work either. Each device is up to date in terms of