add to favorite actionsheet minor fix

This commit is contained in:
TrueZhuanjia committed 2025-06-07 12:42:23 +08:00
1 parent 782ac4c362
commit d9dbb2bcee
2 files changed
+14 -13

No files matched your search

@@ -1106,8 +1106,7 @@ const int FrontViewPositionNone = 0xff;
[menuController setMenuItems:@[item1, item2]]; [menuController setMenuItems:@[item1, item2]];
UIView *targetView = [sender valueForKey:@"view"]; UIView *targetView = [sender valueForKey:@"view"];
[menuController setTargetRect:targetView.bounds inView:targetView]; [menuController showMenuFromView:targetView rect:targetView.bounds];
[menuController setMenuVisible:YES animated:YES];
[self becomeFirstResponder]; [self becomeFirstResponder];
} }
@@ -667,13 +667,7 @@ BOOL isCustomResolution(CGSize res) {
else NSLog(@"hit test: not setting stack captured"); else NSLog(@"hit test: not setting stack captured");
} }
- (void)handleLongPress:(UILongPressGestureRecognizer *)gesture { - (UIAlertController* )prepareAddToFavoriteActionSheet{
CGPoint locationInParentStack = [gesture locationInView:parentStack];
CGPoint locationInRootView = [gesture locationInView:self.view.superview];
if(currentSettingsMenuMode == AllSettings){
if (gesture.state == UIGestureRecognizerStateBegan) {
[self findCapturedStackByTouchLocation:locationInParentStack];
if(capturedStack == nil) return;
// actionsheet // actionsheet
UIAlertController *actionSheet = [UIAlertController alertControllerWithTitle:nil UIAlertController *actionSheet = [UIAlertController alertControllerWithTitle:nil
message:nil message:nil
@@ -685,10 +679,18 @@ BOOL isCustomResolution(CGSize res) {
// 在这里执行收藏逻辑 // 在这里执行收藏逻辑
}]; }];
[actionSheet addAction:addFavoriteAction]; [actionSheet addAction:addFavoriteAction];
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { return actionSheet;
actionSheet.popoverPresentationController.sourceView = self.view; }
actionSheet.popoverPresentationController.sourceRect = CGRectMake(locationInParentStack.x, locationInParentStack.y, 1, 1);
} - (void)handleLongPress:(UILongPressGestureRecognizer *)gesture {
CGPoint locationInParentStack = [gesture locationInView:parentStack];
CGPoint locationInRootView = [gesture locationInView:self.view.superview];
if(currentSettingsMenuMode == AllSettings){
if (gesture.state == UIGestureRecognizerStateBegan) {
[self findCapturedStackByTouchLocation:locationInParentStack];
if(capturedStack == nil) return;
UIAlertController* actionSheet = [self prepareAddToFavoriteActionSheet];
actionSheet.popoverPresentationController.sourceView = capturedStack;
[self presentViewController:actionSheet animated:YES completion:nil]; [self presentViewController:actionSheet animated:YES completion:nil];
} }
} }