Post

Replies

Boosts

Views

Activity

Mac Catalyst UIWindowScene requestGeometryUpdateWithPreferences: doesn't respect provided systemFrame origin.
On app launch I'm trying to specify a reasonable initial value for the window's frame. Using the recommended API I create a UIWindowSceneGeometryPreferencesMac object and pass it to -requestGeometryUpdateWithPreferences:errorHandler: in -scene:willConnectToSession:options: This method respects the value passed in as the size but does not seem to respect the requested origin. Initially I'm always placed at origin 0, 0 for the first window which doesn't look particularly good. I think I'd like to be inset on the x-axis a bit, or maybe even position the window in the center of the screen on app launch. Is there anyway to get more control over the window frame on Mac Catalyst?
3
0
884
Dec ’22
Mac Catalyst UIActivity subclasses that implement the activityViewController property don't work. API is broken.
I have a UIActivity subclass that generates data asynchronously. So as an example say we have a "Generate Spreadsheet" activity. In the implementation of the activity: -(UIViewController*)activityViewController {     if (_backingViewController == nil)     {         _backingViewController = [[ActivityWithProgressUIViewController alloc]init];         [self performActivity]; // <-- start the activity... always required to manually start the activity when providing a view controller.     }     return _backingViewController; }// return non-nil to have view controller presented modally. call activityDidFinish at end. default returns nil Then in -performActivity override...do the work... -(void)performActivity {     NSLog(@"start performing...pretend we are creating a spreadsheet..");     dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(10 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{         [self activityDidFinish:YES];         NSLog(@"Finished performing.");     }); } And that works on iOS. On Mac Catalyst the system never dismisses the view controller returned by UIActivity subclass. Also the UIActivityViewController's completionWithItemsHandler is called immediately after the custom activity is invoked, the system doesn't wait for the custom activity to call -activityDidFinish: The system just leaves the abandoned view controller returned by the custom activity on screen. Works fine on iOS. Easy to reproduce in a sample project.
5
0
634
Dec ’22
Mac Catalyst Make Text in UICollectionViewCell configured with UIListContentConfiguration selectable with mouse/trackpad?
I have a UICollectionView in the list style. I have cells that use   UIListContentConfiguration. All this is set up in the normal way: UIListContentConfiguration *contentConfig = cell.defaultContentConfiguration;   contentConfig.text = @"Bla text"; cell.contentConfiguration = contentConfig; But I can't figure out how to make the text selectable on Mac Catalyst with the mouse? On iOS this is okay (though selectable text would be nice there too) but on Mac users would really expect the text to be selectable in this area of my app's UI. Is there anyway to configure this?
3
0
708
Dec ’22
Mac Catalyst UITableView swipe actions sometimes don't work (either getting swallowed by the two finger drag gesture to open the Notification Center or something else)
I have a UITableView in the supplementary column of a UISplitViewController. Every so often trackpad gestures to reveal swipe actions stop working. I believe the gesture may be getting swallowed by the two finger drag to open the Notification Center but I can't be sure, maybe there's another gesture swallowing it. I keep sliding my fingers to reveal the swipe action with no luck. Eventually swipe actions start working again but it really wouldn't be acceptable for me to ship an app this way. Anyone else have issues with the swipe gestures on UITableView not working properly? Advice/workarounds are welcomed.
0
0
497
Dec ’22
Breakpoint on os_log gets hit three times
When I set breakpoints on os_log statements like below: os_log_debug(OS_LOG_DEFAULT, "hi"); //&lt;--break point RIGHT on this line…. I have to click the "Continue Program Execution" button three times to actually continue program execution. At first I thought my method was being called multiple times unexpectedly but it’s not. I just have to keep hitting the continue program execution button. I’m not hitting “Step over” or “step into”. I’m hitting the “Continue Program Execution” button. FB9792745
1
0
739
Dec ’22
Mac Catalyst Stop UITableView from Discarding Selection When a Row is Swiped?
I have a UITableView that supports multiple selection on Mac. My table view also supports swipe actions. When a row is selected and I swipe on another table view row to expose swipe actions, UITableView discards the current selection for seemingly no reason. To reproduce: Configure a UITableView that allows multiple selection. Configure swipe actions. Run the app. Select a couple rows (via Command click or shift click). Two finger drag on the track pad to expose a swipe action on another row. Swipe to hide the swipe actions (not invoking an action). UITableView discards the entire selection for no apparent reason. Also the UITableView discards the selection without even informing the delegate (I have a label displaying the selection count in the UI and it still shows the selection count before UITableView clears the selection when a row is swiped). I don't want to discard the selection just because a swipe action is exposed. I tried working around the problem by reselecting the rows index paths in -tableView:didEndEditingRowAtIndexPath: -(void)tableView:(UITableView*)tableView didEndEditingRowAtIndexPath:(nullable NSIndexPath*)indexPath { //Swipe action is over..fix the selection: [self reselectIndexPathsAtTheEndOfSwipeActionEditing]; / } But when one of the selected index paths is outside the visible region of the table view scroll position jumps after programmatically reselecting the rows which looks wrong... Anyone have a workaround for this?
0
0
776
Dec ’22
Mac Catalyst: UITableView focus gets separated from the selection after Programmatically Changing the Selection
After programmatically changing the selection of a UITableview, focus gets separated from the selection if I programmatically select a cell beyond the visible region of the table view. That is to say the focused cell is not the selected cell which any user would consider wrong. To reproduce Add a button to select the "Next" row in a table (deselect the previous selected row, then select the next row just below it) Click the button. Keep clicking the button to move the table view selection down. Once you select the row outside the visible region of the table view focus cell gets separated from the selection. I created a bug report on this with a sample project: FB11803433 Trying to scroll the row visible before programmatically changing the selection doesn't always work around the issue. I experimented with -performSelector:withObject:afterDelay: calls and -setNeedsFocusUpdate and -updateFocusIfNeeded calls but it doesn't always seem to work.
1
0
546
Nov ’22
Mac Catalyst: How to make a "Done" button that invokes its action when the return key is pressed?
On macOS it is typical for apps to have a "Done" button showing at the bottom of a window sheet. Usually the button is blue (or whatever your system accent color is set to) and this button can be invoked by pressing the return key. On NSButton all you do is assign the return key as the key equivalent. So in the Mac Catalyst environment how do I achieve this behavior? I'm able to get the button to look exactly how I want configuring UIButton like this: UIButton *doneButton = [UIButton buttonWithType:UIButtonTypeSystem]; [doneButton setTitle:@"Done" forState:UIControlStateNormal]; doneButton.role = UIButtonRolePrimary; Is there a quick way to get its action to be invoked when the return key is pressed or do I have to manually implement UIKeyCommand? Thanks in advance to anyone who answers.
0
0
559
Nov ’22
How does UNNotificationResponse determine targetScene if app specifies multiple Scene Configurations?
I use UNUserNotificationCenterDelegate. I'm in the process of adding new scene configurations for windows for the Mac environment. Some of these windows are auxiliary windows. So I was just wondering what happens with UNNotificationResponse targetScene property. In -userNotificationCenter:didReceiveNotificationResponse:withCompletionHandler: is it possible for one of the auxiliary window scenes to be the targetScene or does UNNotificationResponse always choose the configuration at index 0 in the info.plist?
1
0
654
Nov ’22
Mac Catalyst: UINavigationController incorrectly blocks -setViewControllers:animated: call on UINavigationController when a transition/presentation is occurring on a different view controller.
I have a triple UISplitViewController. A UINavigationController is in the secondary column. When the selection changes in the supplementary column I call -setViewControllers:animated: and pass the navigation controller the new vc. I noticed sometimes the navigation view controller isn't updating and this logs out: setViewControllers:animated: called on while an existing transition or presentation is occurring; the navigation stack will not be updated. So this happens when the Split View controller itself is presenting another view controller modally (say a view controller with a UIActivityIndicatorView in it to show loading progress). But there is no transition/presentation occurring on the UINavigationController contained in the secondary view controller column itself. The presentation occurring on the UISplitViewController is completely separate and unrelated to the UINavigationController's navigation stack that's in the secondary column and therefore I should not be prevented from modifying the navigation stack.
1
0
685
Nov ’22
NSUndoManager -setActionName: being ignored on Mac Catalyst
So I just noticed that my calls to -setActionName: on NSUndoManager are not properly updating the Undo/Redo menu item titles in the menu bar on Mac Catalyst. At first I thought maybe my actionName string was too long, so I just created a really simple sample project and ...yeah...my calls to -setActionName are ignored. The menu bar items just say "Undo" and "Redo.." Sample: -(IBAction)changeBackgroundColorAction:(UIButton*)sender {     UIColor *currentBGColor = self.view.backgroundColor;     self.view.backgroundColor = UIColor.yellowColor;     NSUndoManager *undoManager = self.undoManager;     [undoManager registerUndoWithTarget:self selector:@selector(setBackgroundColorWithColor:) object:currentBGColor];     [undoManager setActionName:@"Change BG Color"]; } I'm really starting to regret not using AppKit...
4
0
688
Nov ’22
-acceptsFirstMouse: behavior from Mac Catalyst?
I'm looking to achieve the AppKit equivalent of -acceptsFirstMouse: from the Mac Catalyst environment: https://developer.apple.com/documentation/appkit/nsview/1483410-acceptsfirstmouse?language=objc "Overridden by subclasses to return YES if the view should be sent a mouseDown: message for an initial mouse-down event, NO if not." Is this possible?
1
0
544
Nov ’22