Post

Replies

Boosts

Views

Activity

Reply to Adding border colour to page control applies background colour to page control
I would like to check a few points in this func : func customPageControl(dotFillColor:UIColor, dotBorderColor:UIColor, dotBorderWidth:CGFloat) { for (pageIndex, dotView) in self.subviews.enumerated() { if self.currentPage == pageIndex { dotView.backgroundColor = dotFillColor dotView.layer.cornerRadius = dotView.frame.size.height / 2 }else{ dotView.backgroundColor = .white dotView.layer.cornerRadius = dotView.frame.size.height / 2 dotView.layer.borderColor = dotBorderColor.cgColor dotView.layer.borderWidth = dotBorderWidth } } } You do not reset colors when it's not the current page. Why ? you set corner radius in all cases, that could be outside the if. More critical, pageControl has only one subview (each dot is not a subview). So what do you expect with: for (pageIndex, dotView) in self.subviews.enumerated() { } I would try the following: func customPageControl(dotFillColor:UIColor, dotBorderColor:UIColor, dotBorderWidth:CGFloat) { for (pageIndex, dotView) in self.subviews.enumerated() { print("pageIndex", pageIndex) // You should get only 0 dotView.layer.cornerRadius = dotView.frame.size.height / 2 dotView.layer.borderWidth = dotBorderWidth if self.currentPage == pageIndex { dotView.backgroundColor = dotFillColor.cgColor // in case you need cgColor dotView.layer.borderColor = // any color you need } else { dotView.backgroundColor = .white dotView.layer.borderColor = dotBorderColor.cgColor } } } To get what you want, you may need to create your custom pageControl or use those 2 func: The first would be the filled dot, the other the empty dot. var preferredIndicatorImage: UIImage? The preferred image for indicators. func setIndicatorImage(UIImage?, forPage: Int) Sets the indicator image for the specified page.
Topic: UI Frameworks SubTopic: UIKit Tags:
May ’21
Reply to GCD running background thread in spritekit
Where does it crash exactly ? In moveBox ? I do not understand wheree you add a node here. Looking at the crash report, I would do differently to enumerate the array: func moveBox() { for i in 0..boxArray.count { if var box = self.childNode(withName: "\(boxArray[i])") as? SKSpriteNode { // Need also to test it can be cast to SKSpriteNode box.position.x += 10 } } }
Topic: Programming Languages SubTopic: Swift Tags:
May ’21
Reply to Managing External Subviews and Layout
Why don't you create the splitView in IB ? With 2 subviews, which are A and B. Then in the viewDidLoad of the splitView or even in applicationDidFinishLaunching, you can insert any object like this (to insert a dummy button in the first view (A for you if I understand well)): let button = NSButton(title: "New", target: self, action: nil) button.frame = CGRect(x: 20, y: 120, width: 100, height: 20) (self.splitView.subviews[0] as! NSScrollView).contentView.addSubview(button) With the same pattern, you can instantiate viewA and viewB and add them to the corresponding subview of the splitView. For the constraints, you can define them in the nib or programmatically (you should subclass NSScrollView for A and B to connect to the IBOutlets in that case). This is Swift, but you should have no problem to write it in objC. If that answers your question, don't forget to close the thread by marking this answer as correct. Otherwise, please explain the remaining problem.
Topic: UI Frameworks SubTopic: AppKit Tags:
May ’21
Reply to Managing External Subviews and Layout
when [[alloc] initWithNibName] returned, it was not guaranteed that those nibs would be loaded I do think it is loaded when initWithNibName returns. As for avoiding an extra view, I do not see this as a problem. There are so many objects allocated by the system, that even if you have hundreds of view, just an extra view each time will not make a difference. There are probably many other places in code more important top focus on if you need to optimize. In anycase, good to read it works. You should close the thread now.
Topic: UI Frameworks SubTopic: AppKit Tags:
May ’21
Reply to How to create IEEE P1363 signature
Are you sure key is a valid SecKey ? A SecKey instance that represents a key that is stored in a keychain can be safely cast to a SecKeychainItem for manipulation as a keychain item. On the other hand, if the key is not stored in a keychain, casting the object to a SecKeychainItem and passing it to Keychain Services functions returns errors. Do you get a printed error ? If yes, which ? Do you get error when calling SecKeyVerifySignature ?
Topic: Programming Languages SubTopic: Swift Tags:
May ’21
Reply to Adding border colour to page control applies background colour to page control
I would like to check a few points in this func : func customPageControl(dotFillColor:UIColor, dotBorderColor:UIColor, dotBorderWidth:CGFloat) { for (pageIndex, dotView) in self.subviews.enumerated() { if self.currentPage == pageIndex { dotView.backgroundColor = dotFillColor dotView.layer.cornerRadius = dotView.frame.size.height / 2 }else{ dotView.backgroundColor = .white dotView.layer.cornerRadius = dotView.frame.size.height / 2 dotView.layer.borderColor = dotBorderColor.cgColor dotView.layer.borderWidth = dotBorderWidth } } } You do not reset colors when it's not the current page. Why ? you set corner radius in all cases, that could be outside the if. More critical, pageControl has only one subview (each dot is not a subview). So what do you expect with: for (pageIndex, dotView) in self.subviews.enumerated() { } I would try the following: func customPageControl(dotFillColor:UIColor, dotBorderColor:UIColor, dotBorderWidth:CGFloat) { for (pageIndex, dotView) in self.subviews.enumerated() { print("pageIndex", pageIndex) // You should get only 0 dotView.layer.cornerRadius = dotView.frame.size.height / 2 dotView.layer.borderWidth = dotBorderWidth if self.currentPage == pageIndex { dotView.backgroundColor = dotFillColor.cgColor // in case you need cgColor dotView.layer.borderColor = // any color you need } else { dotView.backgroundColor = .white dotView.layer.borderColor = dotBorderColor.cgColor } } } To get what you want, you may need to create your custom pageControl or use those 2 func: The first would be the filled dot, the other the empty dot. var preferredIndicatorImage: UIImage? The preferred image for indicators. func setIndicatorImage(UIImage?, forPage: Int) Sets the indicator image for the specified page.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
May ’21
Reply to All controls cannot display text in release mode
Could you show the relevant code ? Does it occur in simulator ? On device ? Which iOS version in each case ?
Replies
Boosts
Views
Activity
May ’21
Reply to iPhone 7 lagging after updating to 14.5.1
Did you try in Settings to disable battery throttling ? Have a look here: https ://www.techrepublic .com/article/how-to-turn-off-battery-throttling-on-your-iphone/
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
May ’21
Reply to Xcode documentation deep dive
AFAIK, such doc does not exist, at least from Apple (which we may regret). There are a lot of tutorial, for beginners notably, not always uptodate with Xcode 12, as Xcode evolves pretty fast). Here is one as example;: https ://learnappmaking. com/xcode-tutorial/
Replies
Boosts
Views
Activity
May ’21
Reply to Location permission dialog disappears after 1 second
Did you set the info.plist to request authorisation ? I added them, and got the authorization request dialog to show until I accept or deny.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
May ’21
Reply to UIPasteboard.general no longer accessible from INExtension?
Just a guess, for what it's worth. Maybe there are some import that changed and you may have to explicitly add some import declaration (can't tell which) ?
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
May ’21
Reply to GCD running background thread in spritekit
Where does it crash exactly ? In moveBox ? I do not understand wheree you add a node here. Looking at the crash report, I would do differently to enumerate the array: func moveBox() { for i in 0..boxArray.count { if var box = self.childNode(withName: "\(boxArray[i])") as? SKSpriteNode { // Need also to test it can be cast to SKSpriteNode box.position.x += 10 } } }
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
May ’21
Reply to Crash in app window resizing code
Glad that it helped. So which was the correct answer in this thread ?
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
May ’21
Reply to Managing External Subviews and Layout
Why don't you create the splitView in IB ? With 2 subviews, which are A and B. Then in the viewDidLoad of the splitView or even in applicationDidFinishLaunching, you can insert any object like this (to insert a dummy button in the first view (A for you if I understand well)): let button = NSButton(title: "New", target: self, action: nil) button.frame = CGRect(x: 20, y: 120, width: 100, height: 20) (self.splitView.subviews[0] as! NSScrollView).contentView.addSubview(button) With the same pattern, you can instantiate viewA and viewB and add them to the corresponding subview of the splitView. For the constraints, you can define them in the nib or programmatically (you should subclass NSScrollView for A and B to connect to the IBOutlets in that case). This is Swift, but you should have no problem to write it in objC. If that answers your question, don't forget to close the thread by marking this answer as correct. Otherwise, please explain the remaining problem.
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
May ’21
Reply to Managing External Subviews and Layout
when [[alloc] initWithNibName] returned, it was not guaranteed that those nibs would be loaded I do think it is loaded when initWithNibName returns. As for avoiding an extra view, I do not see this as a problem. There are so many objects allocated by the system, that even if you have hundreds of view, just an extra view each time will not make a difference. There are probably many other places in code more important top focus on if you need to optimize. In anycase, good to read it works. You should close the thread now.
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
May ’21
Reply to How to create IEEE P1363 signature
Are you sure key is a valid SecKey ? A SecKey instance that represents a key that is stored in a keychain can be safely cast to a SecKeychainItem for manipulation as a keychain item. On the other hand, if the key is not stored in a keychain, casting the object to a SecKeychainItem and passing it to Keychain Services functions returns errors. Do you get a printed error ? If yes, which ? Do you get error when calling SecKeyVerifySignature ?
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
May ’21
Reply to Xcode
Did you try to do what you were asked to ? What happens then ?
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
May ’21
Reply to How to create IEEE P1363 signature
My question was whether SecKeyVerifySignature did return true ?
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
May ’21
Reply to Sometimes the DTD file of info.plist xml is giving me XML parsing error
What have you changed on your side ? update Xcode ? modified project ? Is the same occurring for every project ? Are you sure the error points to what you showed ? May be the line with dict dict keyCFBundleDevelopmentRegion/key stringen/string Could you post more of the info plist ?
Replies
Boosts
Views
Activity
May ’21
Reply to Data not passing correctly - SwiftUI, CoreData
Try changing line 12 by adding id:                 ForEach(group.ongoingItems, id:\.self) { item in
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
May ’21