Post

Replies

Boosts

Views

Created

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
640
Nov ’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
856
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"); //<--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
817
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
547
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
835
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
741
Dec ’22
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
1.1k
Dec ’22
Mac Catalyst on Multiple Displays: Using UIWindowSceneGeometryPreferencesMac to set a default window size causes new windows to open on the wrong display
In the WWDC 2022 video "Bring your iOS App to the Mac" there is sample code which shows the recommended way to set the default window size for a new window. According to the presenter it is considered good practice to do this in -scene:willConnectToSession:options: CGRect systemFrame = scene.effectiveGeometry.systemFrame; CGRect newFrame = CGRectMake(systemFrame.origin.x,                                      systemFrame.origin.y,                                      defaultWindowSize.width,                                      defaultWindowSize.height);  UIWindowSceneGeometryPreferencesMac *geometryPrefs = [[UIWindowSceneGeometryPreferencesMac alloc]initWithSystemFrame:newFrame];         [scene requestGeometryUpdateWithPreferences:geometryPrefs errorHandler:^(NSError * _Nonnull error)          {         //Error         }]; So I have a button in my UI that opens a new window that uses this window scene delegate class. I have a laptop and external display connected. Now my app's window is on the external display and when I click the button the opens the new window, the new window opens on the laptop's main display (the display physically attached). This is wrong. Setting the requestingScene property on UISceneActivationRequestOptions makes no difference, the new window still opens on the wrong display no matter what. If I comment out the above code that sets the initial window size... the window opens on external display as expected (but now I've lost my window size).
3
0
1.4k
Dec ’22
Sharing Multiple Links at Once on Mac Catalyst Via UIActivityViewController for the Messages Activity?
Is it possible to share multiple links at once on Mac Catalyst to Messages? When I provide multiple urls via the UIActivityItemSource API Messages just picks 1 of the links. The Mail activity handles multiple links without a problem but I'd like this to work with Messages too. I know for sure this is possible in native AppKit but can't seem to figure out how to get this to work on Catalyst. I tried providing the links to UIActivityViewController with a UIActivityItemsConfiguration object instead of using the UIActivityItemSource API but that didn't work either. Thanks in advance
1
0
852
Dec ’22
Mac Catalyst: UIActivityViewController's completionWithItemsHandler block is never called when a system provided UIActivity is selected.
According to the UIActivityViewController documentation for UIActivityViewController's completionWithItemsHandler: Upon the completion of an activity, or the dismissal of the activity view controller, the view controller’s completion block is executed. You can use this block to execute any final code related to the service. However when invoking the "Messages" or "Mail" actions in the UIActivityViewController this block is never called. I'm presenting the UIActivityViewController in a popover. Simple to reproduce. Just do this on Mac Catalyst in a table view delegate (sorry for the poor code formatting but it is hard to format code well on these forums). -(UISwipeActionsConfiguration*)tableView:(UITableView *)tableView leadingSwipeActionsConfigurationForRowAtIndexPath:(nonnull NSIndexPath *)indexPath {     UIContextualAction *shareAction = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleNormal                     title:@"Share"               handler:^(UIContextualAction *action,                                                                                       UIView * _Nonnull sourceView,                                                                                       void (^_Nonnull completionHandler)(BOOL))     {         [self showPopoverWithSourceItem:sourceView completionWithItemsHandler:^(UIActivityType  _Nullable activityType,                                                                                 BOOL completed,                                                                                 NSArray * _Nullable returnedItems,                                                                                 NSError * _Nullable activityError) {             //This block isn't called when Messages/Mail activities are selected. Probably other too but that's all I tested.             completionHandler(completed); //Need to call the UIContextualAction's completionHandler here to close up the swipe actions.         }];     }];     shareAction.image = [UIImage systemImageNamed:@"square.and.arrow.up.fill"];     UISwipeActionsConfiguration *config = [UISwipeActionsConfiguration configurationWithActions:@[shareAction]];     return config; } -(void)showPopoverWithSourceItem:(id<UIPopoverPresentationControllerSourceItem>)sourceItem       completionWithItemsHandler:(UIActivityViewControllerCompletionWithItemsHandler)handler {     NSURL *shareLink = [NSURL URLWithString:@"https://www.apple.com"];          UIActivityViewController *activityViewController = [[UIActivityViewController alloc]initWithActivityItems:@[shareLink]                                                                                         applicationActivities:nil];          activityViewController.completionWithItemsHandler = handler;             activityViewController.modalPresentationStyle = UIModalPresentationPopover;     UIPopoverPresentationController *presentationController;     presentationController = (UIPopoverPresentationController*)activityViewController.presentationController;     presentationController.sourceItem = sourceItem;     presentationController.permittedArrowDirections = UIPopoverArrowDirectionAny;     [self presentViewController:activityViewController animated:YES completion:nil]; } Run that and choose "Mail" or "Messages" in the activity view controller. The table view remains swiped after the activity is invoked and the popover is dismissed. Now if you click outside the popover without invoking an activity the popover dismisses and the completionWithItemsHandler is called. Related but different UIActivityViewController/UIActivity bug I reported here yesterday: https://developer.apple.com/forums/thread/722003 I will file a bug on this and post the number here soon. Can I please work a full day without running into a system bug in this framework....just one day..please. I wouldn't be so disgruntled about all this if my obvious bug reports actually got fixed in a reasonable amount of time but I've been a developer long enough to know that I'm lucky if they get fixed for macOS 14, if ever.
1
0
725
Dec ’22
Mac Catalyst Determine Default Size of NSToolbarItems When Creating them with UIBarButtonItems and SF Symbol Images?
Is there a way to programmatically determine the default size of an NSToolbarItem when creating them on Mac Catalyst like so:  UIImage *downArrowImage = [UIImage systemImageNamed:@"arrow.down"]; UIBarButtonItem *goDownUIBarButtonItem = [[UIBarButtonItem alloc]initWithImage:downArrowImage style:UIBarButtonItemStylePlain target:nil action:@selector(navigateDownard:)];  NSToolbarItem *nsToolbarItem = [NSToolbarItem itemWithItemIdentifier:itemIdentifier barButtonItem:goDownUIBarButtonItem]; Why am I asking? I need to create a toggle toolbar item (which requires me to change the toolbar item's image when the toggle is flipped. I can do this by using NSUIViewToolbarItem and embedding a UIButton. But when you feed an SF Symbol image to UIButton and call sizeToFit on it it doesn't generate a view that matches the size of UIBarButtonItems for all the other NSToolbarItems next to it. I can hard code size constraints in like this to make it size properly:  NSLayoutConstraint *width = [theUIButtonToEmbedInToolbarItem.widthAnchor constraintEqualToConstant:32.0];     NSLayoutConstraint *height = [theUIButtonToEmbedInToolbarItem.heightAnchor constraintEqualToConstant:32.0]; //activate these constraints and embed the UIButton in the NSToolbarItem. And that's works but I'm guessing the size so the layout could break in a OS update. I tried just feeding an SF Symbol image to NSToolbarItem's image property directly but then the toolbar item doesn't draw at all (edit: this is only true when using an NSToolbarItem subclass, which I created to change the toolbar item's image itself when the toggle property is flipped) //Inside my NSToolbarItem subclass. -(void)setOn:(BOOL)isOn { if (_on != on) { _on = isOn; self.image = (isOn) ? self.onImage : self.offImage; } } So when using NSToolbaritem's image property directly setting the image property works fine, this means I have to track the toggle state externally which is possible but definitely not as nice). Edit: Actually if forgot to modify my toolbar item subclass to subclass NSToolbarItem directly (was subclassing NSUIViewToolbarItem when I was first experimenting with using UIButton). Using the image property on NSToolbarItem directly works for me. So I'm happy. I still think it'd be useful for clients that need to embed custom views inside a NSToolbarItem to get some kind of size recommendation.
1
0
705
Dec ’22
Mac Catalyst How to Play NSBeep
Is there a way to play NSBeep() from the Mac Catalyst environment? Thanks in advance to anyone who answers.
Replies
1
Boosts
0
Views
1k
Activity
Nov ’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.
Replies
1
Boosts
0
Views
640
Activity
Nov ’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?
Replies
0
Boosts
0
Views
856
Activity
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
Replies
1
Boosts
0
Views
817
Activity
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.
Replies
0
Boosts
0
Views
547
Activity
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?
Replies
3
Boosts
0
Views
835
Activity
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.
Replies
5
Boosts
0
Views
741
Activity
Dec ’22
How to add add separator menu items on Mac Catalyst?
Creating a context menu via UIContextMenuConfiguration creates the NSMenu as expected on Mac Catalyst but how do I add separator menu items? https://developer.apple.com/documentation/appkit/nsmenuitem/1514838-separatoritem?language=objc I'm talking about context menus that are shown via right-click, not the menu bar.
Replies
1
Boosts
0
Views
1.4k
Activity
Dec ’22
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?
Replies
3
Boosts
0
Views
1.1k
Activity
Dec ’22
Mac Catalyst on Multiple Displays: Using UIWindowSceneGeometryPreferencesMac to set a default window size causes new windows to open on the wrong display
In the WWDC 2022 video "Bring your iOS App to the Mac" there is sample code which shows the recommended way to set the default window size for a new window. According to the presenter it is considered good practice to do this in -scene:willConnectToSession:options: CGRect systemFrame = scene.effectiveGeometry.systemFrame; CGRect newFrame = CGRectMake(systemFrame.origin.x,                                      systemFrame.origin.y,                                      defaultWindowSize.width,                                      defaultWindowSize.height);  UIWindowSceneGeometryPreferencesMac *geometryPrefs = [[UIWindowSceneGeometryPreferencesMac alloc]initWithSystemFrame:newFrame];         [scene requestGeometryUpdateWithPreferences:geometryPrefs errorHandler:^(NSError * _Nonnull error)          {         //Error         }]; So I have a button in my UI that opens a new window that uses this window scene delegate class. I have a laptop and external display connected. Now my app's window is on the external display and when I click the button the opens the new window, the new window opens on the laptop's main display (the display physically attached). This is wrong. Setting the requestingScene property on UISceneActivationRequestOptions makes no difference, the new window still opens on the wrong display no matter what. If I comment out the above code that sets the initial window size... the window opens on external display as expected (but now I've lost my window size).
Replies
3
Boosts
0
Views
1.4k
Activity
Dec ’22
Sharing Multiple Links at Once on Mac Catalyst Via UIActivityViewController for the Messages Activity?
Is it possible to share multiple links at once on Mac Catalyst to Messages? When I provide multiple urls via the UIActivityItemSource API Messages just picks 1 of the links. The Mail activity handles multiple links without a problem but I'd like this to work with Messages too. I know for sure this is possible in native AppKit but can't seem to figure out how to get this to work on Catalyst. I tried providing the links to UIActivityViewController with a UIActivityItemsConfiguration object instead of using the UIActivityItemSource API but that didn't work either. Thanks in advance
Replies
1
Boosts
0
Views
852
Activity
Dec ’22
Mac Catalyst: UIActivityViewController's completionWithItemsHandler block is never called when a system provided UIActivity is selected.
According to the UIActivityViewController documentation for UIActivityViewController's completionWithItemsHandler: Upon the completion of an activity, or the dismissal of the activity view controller, the view controller’s completion block is executed. You can use this block to execute any final code related to the service. However when invoking the "Messages" or "Mail" actions in the UIActivityViewController this block is never called. I'm presenting the UIActivityViewController in a popover. Simple to reproduce. Just do this on Mac Catalyst in a table view delegate (sorry for the poor code formatting but it is hard to format code well on these forums). -(UISwipeActionsConfiguration*)tableView:(UITableView *)tableView leadingSwipeActionsConfigurationForRowAtIndexPath:(nonnull NSIndexPath *)indexPath {     UIContextualAction *shareAction = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleNormal                     title:@"Share"               handler:^(UIContextualAction *action,                                                                                       UIView * _Nonnull sourceView,                                                                                       void (^_Nonnull completionHandler)(BOOL))     {         [self showPopoverWithSourceItem:sourceView completionWithItemsHandler:^(UIActivityType  _Nullable activityType,                                                                                 BOOL completed,                                                                                 NSArray * _Nullable returnedItems,                                                                                 NSError * _Nullable activityError) {             //This block isn't called when Messages/Mail activities are selected. Probably other too but that's all I tested.             completionHandler(completed); //Need to call the UIContextualAction's completionHandler here to close up the swipe actions.         }];     }];     shareAction.image = [UIImage systemImageNamed:@"square.and.arrow.up.fill"];     UISwipeActionsConfiguration *config = [UISwipeActionsConfiguration configurationWithActions:@[shareAction]];     return config; } -(void)showPopoverWithSourceItem:(id<UIPopoverPresentationControllerSourceItem>)sourceItem       completionWithItemsHandler:(UIActivityViewControllerCompletionWithItemsHandler)handler {     NSURL *shareLink = [NSURL URLWithString:@"https://www.apple.com"];          UIActivityViewController *activityViewController = [[UIActivityViewController alloc]initWithActivityItems:@[shareLink]                                                                                         applicationActivities:nil];          activityViewController.completionWithItemsHandler = handler;             activityViewController.modalPresentationStyle = UIModalPresentationPopover;     UIPopoverPresentationController *presentationController;     presentationController = (UIPopoverPresentationController*)activityViewController.presentationController;     presentationController.sourceItem = sourceItem;     presentationController.permittedArrowDirections = UIPopoverArrowDirectionAny;     [self presentViewController:activityViewController animated:YES completion:nil]; } Run that and choose "Mail" or "Messages" in the activity view controller. The table view remains swiped after the activity is invoked and the popover is dismissed. Now if you click outside the popover without invoking an activity the popover dismisses and the completionWithItemsHandler is called. Related but different UIActivityViewController/UIActivity bug I reported here yesterday: https://developer.apple.com/forums/thread/722003 I will file a bug on this and post the number here soon. Can I please work a full day without running into a system bug in this framework....just one day..please. I wouldn't be so disgruntled about all this if my obvious bug reports actually got fixed in a reasonable amount of time but I've been a developer long enough to know that I'm lucky if they get fixed for macOS 14, if ever.
Replies
1
Boosts
0
Views
725
Activity
Dec ’22
Crash on iOS 16.2: -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:
I'm starting to see the behavior described here: https://stackoverflow.com/questions/74491422/uitableview-createpreparedcellforglobalrowwithindexpathwilldisplay-1256 Starting on iOS 16.2 for me (though the creator of the Stackoverflow thread started seeing in in 16.1.1. Anyone else experiencing this?
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
13
Boosts
0
Views
4.9k
Activity
Dec ’22
Mac Catalyst Determine Default Size of NSToolbarItems When Creating them with UIBarButtonItems and SF Symbol Images?
Is there a way to programmatically determine the default size of an NSToolbarItem when creating them on Mac Catalyst like so:  UIImage *downArrowImage = [UIImage systemImageNamed:@"arrow.down"]; UIBarButtonItem *goDownUIBarButtonItem = [[UIBarButtonItem alloc]initWithImage:downArrowImage style:UIBarButtonItemStylePlain target:nil action:@selector(navigateDownard:)];  NSToolbarItem *nsToolbarItem = [NSToolbarItem itemWithItemIdentifier:itemIdentifier barButtonItem:goDownUIBarButtonItem]; Why am I asking? I need to create a toggle toolbar item (which requires me to change the toolbar item's image when the toggle is flipped. I can do this by using NSUIViewToolbarItem and embedding a UIButton. But when you feed an SF Symbol image to UIButton and call sizeToFit on it it doesn't generate a view that matches the size of UIBarButtonItems for all the other NSToolbarItems next to it. I can hard code size constraints in like this to make it size properly:  NSLayoutConstraint *width = [theUIButtonToEmbedInToolbarItem.widthAnchor constraintEqualToConstant:32.0];     NSLayoutConstraint *height = [theUIButtonToEmbedInToolbarItem.heightAnchor constraintEqualToConstant:32.0]; //activate these constraints and embed the UIButton in the NSToolbarItem. And that's works but I'm guessing the size so the layout could break in a OS update. I tried just feeding an SF Symbol image to NSToolbarItem's image property directly but then the toolbar item doesn't draw at all (edit: this is only true when using an NSToolbarItem subclass, which I created to change the toolbar item's image itself when the toggle property is flipped) //Inside my NSToolbarItem subclass. -(void)setOn:(BOOL)isOn { if (_on != on) { _on = isOn; self.image = (isOn) ? self.onImage : self.offImage; } } So when using NSToolbaritem's image property directly setting the image property works fine, this means I have to track the toggle state externally which is possible but definitely not as nice). Edit: Actually if forgot to modify my toolbar item subclass to subclass NSToolbarItem directly (was subclassing NSUIViewToolbarItem when I was first experimenting with using UIButton). Using the image property on NSToolbarItem directly works for me. So I'm happy. I still think it'd be useful for clients that need to embed custom views inside a NSToolbarItem to get some kind of size recommendation.
Replies
1
Boosts
0
Views
705
Activity
Dec ’22
NSTitlebarAccessoryViewController Equivalent API on Mac Catalyst?
Is there any API in Mac Catalyst that wraps the AppKit functionality we get in NSTitlebarAccessoryViewController?
Replies
0
Boosts
0
Views
547
Activity
Dec ’22