Posts

Post not yet marked as solved
1 Replies
256 Views
My iPad app supports features such Copy (cmd-C) and Paste (cmd-V). How can I get these to show in the Edit menu when I hold down the Command key? Undo (cmd-Z) and Redo (shift-cmd-Z) show perfectly. Looks like the system internally looks at UndoManager. Same with Hide Sidebar: system detected presence of Sidebar and is showing the keyboard shortcut to hide it. Ramon.
Posted
by Phantom59.
Last updated
.
Post not yet marked as solved
2 Replies
529 Views
I'm creating a new scene like: UIApplication.shared.requestSceneSessionActivation(nil, userActivity: activity, options: nil/*options*/) { error in       dPrint("\(error)")     } The activity parameter has userInfo that I need in the new scene; for example,     activity.userInfo = ["sampleKey":"sampleData"] Here's how I'm creating the new scene:   func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {         guard let windowScene = scene as? UIWindowScene else { return }     window = UIWindow(windowScene: windowScene)     window?.rootViewController = ContainerViewController(to: createSplitViewController())     window?.makeKeyAndVisible()     scene.title = SystemData.appName     if appDelegate.isOnboardingNeeded, let containerController = window?.rootViewController as? ContainerViewController {       appDelegate.launchOnboardingIfNeeded(with: containerController)     }     if let activity = connectionOptions.userActivities.first ?? session.stateRestorationActivity {       dPrint("\(#function) \(activity)")       masterViewController?.restore(from: activity, isStandalone: false, persistentId: scene.session.persistentIdentifier)     }   } The print statement has an empty userInfo. What's the problem?
Posted
by Phantom59.
Last updated
.
Post not yet marked as solved
0 Replies
512 Views
How does one change the width of the primary column? I’ve tried preferredPrimaryColumnWidthFraction when the svc is intantiated but it has no effect. I’m using .doubleColumn style for the svc and my primary view controller is using .sidebar appearance style.
Posted
by Phantom59.
Last updated
.
Post not yet marked as solved
1 Replies
248 Views
I'm getting Xcode compiler error when trying to subclass UIContextMenuConfiguration. Here's simple code that reproduces the problem: @available(iOS 13.0, *) class DateDifferenceContextMenu: UIContextMenuConfiguration { 		init(indexPath: IndexPath, dateDifference: Int) { 				super.init(identifier: nil, previewProvider: nil, actionProvider: nil) 		} } The error reads: Must call a designated initializer of the superclass 'UIContextMenuConfiguration'. My super call matches the designated initializer. What's wrong?
Posted
by Phantom59.
Last updated
.
Post not yet marked as solved
0 Replies
218 Views
I'm having a hard time understanding how UIApplication.shared.requestSceneSessionRefresh - https://developer.apple.com/documentation/uikit/uiapplication/3197903-requestscenesessionrefresh?language=objc actually works. According to the documentation, this is used to update scenes that are in background. But does the API call something in your background scene to allow the UI to update or is it assumed that you've updated your background scene and this call will just capture your UI? Please clarify.
Posted
by Phantom59.
Last updated
.
Post not yet marked as solved
7 Replies
1.5k Views
I've made the architectural changes following best practices to support multiple windows in map. In general, it seems to be working fine except for one general thing. It seems that some the view controller life cycle methods (i.e.: viewWillDisappear, viewDidDisappear) never get called. I realize you can accomplish all that these methods do with the proper delegates in UIWindowSceneDelegate but its not clear to me that this is the way it's supposed to be.In the documentation it's clear that many methods in AppDelegate lifecycle are now replaced by their corresponding UIWindowSceneDelegate methods but I haven't found anything that indicates view controller life cycle.It seems that the initial methods are still called (i.e.: viewWillAppear, viewDidAppear) but not trailing methods (i.e.: viewWillDisappear, viewDidDisappear).Is that how it's suppose to work or am I doing something wrong?Thanks!
Posted
by Phantom59.
Last updated
.
Post not yet marked as solved
0 Replies
413 Views
I've modified my app to create new windows using App Exposé or by dragging out of the dock. But it seems as if my viewcontroller and scene get out of sync. I've verified this by printing the unique persistentIdentifier that comes with every scene session. I'm using storyboards so my scene delegate is rather simple.@available(iOS 13.0, *) class SceneDelegate: UIResponder, UIWindowSceneDelegate { var window: UIWindow? func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { let rootVC = self.window?.rootViewController dPrint("\(#function) rootVC \(String(describing: rootVC!)) pId \((scene as? UIWindowScene)?.session.persistentIde}ntifier ?? "??" )") } }Here's my info.plist<key>UIMainStoryboardFile</key> <string>Main</string> <key>UIApplicationSceneManifest</key> <dict> <key>UIApplicationSupportsMultipleScenes</key> <true/> <key>UISceneConfigurations</key> <dict> <key>UIWindowSceneSessionRoleApplication</key> <array> <dict> <key>UISceneConfigurationName</key> <string>Default Configuration</string> <key>UISceneDelegateClassName</key> <string>$(PRODUCT_MODULE_NAME).SceneDelegate</string> <key>UISceneStoryboardFile</key> <string>Main</string> </dict> </array> </dict> </dict>And AppDelegate: func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { // Based on the name of the configuration iOS will initialize the correct SceneDelegate return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) }I delete the app from the simulator to start with a clean scenerio. I open the app and the initial scene gets created. I print its persistentIdentifier and its: 67926371-9D25-46DC-BD52-8D44B1967B33. I use the a bit and the corresponding persistentIdentifier shows. All good!Now, I go to the home screen, show all windows (only one shows) and select the plus button on the upper right corner to create another scene/window. The new scene gets created and it gets it's own persistentIdentifier: B73F438D-942F-435C-87E7-117BF6E06C79.I use the app and the corresponding persistentIdentifier (for newly created scene) shows. Now I go to the home screen, show all windows and I select the originally created scene. But now the persistentIdentifier shown is still the one for the secodd scene! After creating the second scene, my UI always shows the persistentIdentifier for the second scene regardless of whih scene is in the foreground.This is actually the second app I'm adding multi-window support. So, I have some experience doing this. The first app was similar: storyboard based, etc. It works perfectly. I've verified that the persistentIdentifier is suppoed to follow the viewcontroller.It appears as if the scene and view controllers are out of sync. Why is this happening? What am I missing?
Posted
by Phantom59.
Last updated
.
Post not yet marked as solved
6 Replies
2.4k Views
I have a requirement to animate UICollectionView and UICollectionViewCell frame. The end results is what I but in between there appear to be some phantom cells being mixed in with actual cells being animated. The CV animates to a different size and the CV cells are to match the new size based on settings given to CV's collectionViewLayout.Here's the starting point:Here's how the animation starts to look:The end result is as expected:My final intent is to do this with a UIViewPropertyAnimator() but you see the same problem even if the animation is triggered with a standard UIView animation.The main method called is prepareLayout().internalfunc prepareLayout() { let spacing = buttonTheme.spacing * 2.0 // let theLayout = UICollectionViewFlowLayout() theLayout.invalidateLayout() buttonsView.frame = viewModel.frame theLayout.itemSize = itemSize theLayout.minimumInteritemSpacing = spacing theLayout.minimumLineSpacing = spacing // Needed to correct problem where sometimes only one row (instead of two) shows in iOS 10.x buttonsView.contentInset = UIEdgeInsets(top: spacing, left: spacing, bottom: spacing, right: spacing) // buttonsView.performBatchUpdates({ buttonsView.setCollectionViewLayout(theLayout, animated: true) self.buttonsView.reloadData() // }, completion: nil) buttonsView.setCollectionViewLayout(theLayout, animated: true) }As can seen, I've been playing around with CV's performBatchUpdates() and setCollectionViewLayout() but to no avail. I need to reloadData() because things like the fontSize change during the animation which will be more important when using UIViewPropertyAnimator().My cell is a subclass of UICollectionViewCell that has a UIButton in it. The interaction of the button is disabled so I can handle everything in the CV.Any idea on how to correct this problem is appreciated.
Posted
by Phantom59.
Last updated
.
Post not yet marked as solved
7 Replies
2.1k Views
I have a custom implementation of UIButton with some simple animations based on various touch events. addTarget(self, action: #selector(touchDown), for: [.touchDown, .touchDragEnter]) addTarget(self, action: #selector(touchUp), for: [.touchUpInside, .touchDragExit, .touchCancel] @objc private func touchDown() { animator.stopAnimation(true) backgroundColor = delegate.highlightColor.background setTitleColor(delegate.highlightColor.foreground, for: .normal) setTitleColor(delegate.highlightColor.foreground, for: .highlighted) } @objc private func touchUp() { animator = UIViewPropertyAnimator(duration: 0.5, curve: .easeOut, animations: { self.backgroundColor = self.buttonColor.background self.setTitleColor(self.buttonColor.foreground, for: .normal) }) animator.startAnimation() }Everything works fine for most of my buttons except for a few where I have to do some custom drawing by using draw(rect). It would appear that you can't use draw(rect) if animating things like backgroundColor.Any clue how to get this to work?
Posted
by Phantom59.
Last updated
.
Post not yet marked as solved
2 Replies
1.5k Views
I have an onboarding class that uses UIPageViewController in a container view. The container view is smaller than the app's window to allow use of features behind the container view. This works very nicely in my previous use case.But now I would like use the same onboarding class in an app that uses UISplitViewController. The container view needs to show regardless of the UISplitViewController's display mode.In my previous implementations I would eventually eventually useonboardingHandler.didMove(toParent: viewController)onboardingHandler is my UIPageViewController subclass and viewController is the parent.In a UISplitViewController, which is the parent?How can I reliably detect the parent so my onbaording is always on top?
Posted
by Phantom59.
Last updated
.
Post not yet marked as solved
4 Replies
1k Views
I'm using a standard UITableViewCell and just populating textLabel and detialTextLabel. I want the lables to wrap and show the "..." at the end. This all appears to work fine EXCEPT if I'm using one of the accessibility font sizes. In this case, the entire text is displayed which corrupts my ell because I'm only expecting one line of text for textLabel and detialTextLabel.This appears to only happen in iPad 12.9"; other devices wor as expected. Same symptom in iOS 11 & 12.How can get the labels to truncate even when using accessibility font sizes?
Posted
by Phantom59.
Last updated
.
Post marked as solved
4 Replies
1.7k Views
Hi, I'm updating my app for iOS12. I'm using a collectionView with a custom UICollectionViewLayout with Xcode 10 GM. All Swift code has been converted to Swift 4.2. The app runs fine under iOS 11 but under iOS 12 the layout is completely wrong. It's an issue similar to what is described here. But adding calls to invalidateLayout() all over the place hasn't made a difference.Anybody have any ideas what to do?
Posted
by Phantom59.
Last updated
.
Post not yet marked as solved
5 Replies
2.7k Views
Hi, I'm updating my app to include some new features. The app really has nothing to do with document support but when I uploaded a recent version for testing, I got an email indicating that there were some issues with the delivery; namely,Invalid Document Configuration - Document Based Apps should support either the Document Browser (UISupportsDocumentBrowser = YES) or implement Open In Place (LSSupportsOpeningDocumentsInPlace = YES/NO). Visit https://developer.apple.com/document-based-apps/ for more information.After you’ve corrected the issues, you can use Xcode or Application Loader to upload a new binary to iTunes Connect.I re-built the app, uploaded it again and got the same email. Like I said, my app doesn't deal with documents and I don't show use of those keys anywhere.Why am I getting this message? What do I need to do to corret the situation?Thaks,Ramon.
Posted
by Phantom59.
Last updated
.
Post marked as solved
2 Replies
379 Views
Hello,I'm showing a keyboard in my textview and would like to change the appearance of the keyboard after its been displayed.textView.keyboardAppearance = colorTheme == .classic ? .default : .darkBut it looks like the appearance can only be set before the keyboard is shown.Is there a way to change the appearnce after the keyboard has appeared?Please let me know.Ramon.
Posted
by Phantom59.
Last updated
.