I'm trying to migrate my document-based app to UIDocumentViewController so that it can take advantage of the new launch experience in iOS 18.
Unfortunately, UIDocumentViewController closes the UIDocument when the document is set to nil or the controller is deallocated. This means you can't have the same document in more than one scene.
Is there any way to prevent UIDocumentViewController from closing the document?
-Steve
Post
Replies
Boosts
Views
Activity
Session 10056 refers to the ability to use UIDocumentViewController as the root view controller. Is this the new recommendation? The document-based app template in the seed still uses UIDocumentBrowserViewController for this and doesn't use UIDocumentViewController at all.
-Steve
The What's New in iPad Design session shows a slightly different order of navigation controls than what is available in the WWDC seed.
The Pages toolbar, for example, shows the back button (managed by the toolbar?) followed by the sidebar button (managed by the UISplitView). Apps compiled with the seed feature the sidebar button followed by the back button.
If the former is the design guidance, is there a setting that enables this behavior?
In the "old" TextKit, page-based layout is accomplished by providing an array of NSTextContainers to NSLayoutManager, each with its own NSTextView.
TextKit 2, NSTextLayoutManager allows only a single text container. Additionally, NSTextParagraph seems to be the only concrete NSTextElement class. Paragraphs often need to break across page boundaries.
How would one implement page-based layout in TextKit 2?
On iOS 15 beta 1 running on a 12.9 iPad Pro, the UIDocumentBrowserViewController in my app does not display the Locations group or any of its members (On My iPad, iCloud Drive, etc...). This happens both for the shipping version in the App Store and for versions built with the iOS 15 SDK. However, the Locations group is displayed correctly in the Files app and for a sample project built from the document-based app template.
I assume this is a plist issue or is perhaps related to the fact that the iPad was updated from iOS 13.
I am wondering if anyone else is encountering this.
Submitted as FB9140143.
-Steve
iOS 14 adds menu support to UIBarButtonItems. UIDocumentBrowserViewController lets you add bar button items to the navigation bar via the additionalTrailingNavigationBarButtonItems property. However, adding a bar button item with a menu results in a button whose menu can not be activated by a press or click. (FB8339455)
Anyone have a workaround?
(void)viewDidLoad {
[super viewDidLoad];
// ...
UIMenu *menu = [UIMenu menuWithChildren:[self menuElements]];
self.additionalTrailingNavigationBarButtonItems = @[[[UIBarButtonItem alloc] initWithImage:icon menu:menu]];
}
The macOS 11 HIG says "you can also supply a custom center image" for the new system-generated document icons. Anyone know how?
Clicking the "Use system generated icons" checkbox (which, oddly, is set to a mixed state by default in Xcode 12b4) adds the CFBundleTypeIconSystemGenerated entry to the plist, but there does not appear to be a way to specify a center image.
The existing CFBundleTypeIconFile value is denoted in the UI as the "Legacy Icon", which I hope means that it will continue to be used on older versions of macOS.
Steve
Thanks for the very informative session (Advancements in the Objective-C runtime).
I'm seeing an exception in a shipping app (FB7781503) on the WWDC20 Big Sur build when calling super from an NSLayoutManager subclass.
(NSArray<NSRulerMarker *> *)rulerMarkersForTextView:(NSTextView *)aTextView paragraphStyle:(NSParagraphStyle *)paraStyle ruler:(NSRulerView *)aRulerView {
NSArray <NSRulerMarker *> *markers = [super rulerMarkersForTextView:aTextView paragraphStyle:paraStyle ruler:aRulerView];
		...
}
The layout manager instance data doesn't seem to have been corrupted prior to calling super, but calling super throws
[STLayoutManager rulerMarkersForTextView:paragraphStyle:ruler:]: unrecognized selector sent to instance 0x7fce12e697b0
I'm wondering if the runtime changes are the cause. I'm able to reproduce this. Any tips for debugging this one?
Steve
On iOS 14, the sidebar in the Calendar app appears to be the primary controller of a split view controller of style UISplitViewControllerStyleDoubleColumn.
The state of the Calendar sidebar is controlled by three bar button items: the Calendars button, the Inbox button, and the Today button.
When the sidebar is visible, these buttons appear in the navigation bar of the sidebar. When the sidebar is closed, the three buttons animate to the secondary controller's navigation bar.
How do you specify the buttons such that they animate on show/hide?
Steve
Has anyone had any luck adopting UITextInteraction?Selection changes made via touch work (mostly) as advertised, but changes made programmatically or via a physical keyboard do not.I believe I've set this up properly. When adding a UITextInteraction to a custom text view that supports UITextInput, iOS installs the following interactions:UITextInteraction
_UITextMenuLinkInteraction
UIContextMenuInteraction
_UIClickPresentationInteraction
_UIClickInteraction
UITextInteraction
UITextSelectionInteraction
UITextLoupeInteraction
UITextServicesInteraction
UITextIndirectKeyboardInteractionThe touch-related UI seems to work.Tapping on the custom text view causes it to become first responder. A UITextSelectionView is installed as a subview, and the caret appears on the screen at the correct location. The caret can be dragged to a new location as expected.Tapping a second time causes the Select/Select All menu to appear.Double-tapping causes a UITextRangeView to be added, along with the appropriate UISelectionGrabberDot and UISelectionGrabber instances and the Cut/Copy… menu appears as expected. Moving handles via touch also works.However, when a physical keyboard like the Smart Folio is attached, pressing the arrow keys has no effect on the selection UI. The setSelectedTextRange: method is called, but the caret or selection handles do not update.Similarly, invoking setSelectedTextRange: programmatically (and calling the appropriate selectionWillChange:/selectionDidChange: methods) does not cause the selection UI to update. For example, choosing Select from the text menu supplied by the interaction invokes the select: method defined in UIResponderStandardEditActions (which is as expected), but setting the selectedTextRange and notifying the inputDelegate has no effect.Since UITextSelectionView and UITextRangeView are private classes, it's not possible to update them from setSelectedTextRange. Setting needsLayout doesn't seem to work either.Is there another way to update the selection UI when setting the text selection programmatically or via a physical keyboard?-Steve