add to favorite actionsheet minor fix
This commit is contained in:
1 parent
782ac4c362
commit
d9dbb2bcee
2 files changed
+18
-17
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,6 +667,21 @@ BOOL isCustomResolution(CGSize res) {
|
|||||||
else NSLog(@"hit test: not setting stack captured");
|
else NSLog(@"hit test: not setting stack captured");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (UIAlertController* )prepareAddToFavoriteActionSheet{
|
||||||
|
// actionsheet
|
||||||
|
UIAlertController *actionSheet = [UIAlertController alertControllerWithTitle:nil
|
||||||
|
message:nil
|
||||||
|
preferredStyle:UIAlertControllerStyleActionSheet];
|
||||||
|
UIAlertAction *addFavoriteAction = [UIAlertAction actionWithTitle:[LocalizationHelper localizedStringForKey:@"Add to favorite"]
|
||||||
|
style:UIAlertActionStyleDefault
|
||||||
|
handler:^(UIAlertAction * _Nonnull action) {
|
||||||
|
[self addSettingToFavorite:self->capturedStack];
|
||||||
|
// 在这里执行收藏逻辑
|
||||||
|
}];
|
||||||
|
[actionSheet addAction:addFavoriteAction];
|
||||||
|
return actionSheet;
|
||||||
|
}
|
||||||
|
|
||||||
- (void)handleLongPress:(UILongPressGestureRecognizer *)gesture {
|
- (void)handleLongPress:(UILongPressGestureRecognizer *)gesture {
|
||||||
CGPoint locationInParentStack = [gesture locationInView:parentStack];
|
CGPoint locationInParentStack = [gesture locationInView:parentStack];
|
||||||
CGPoint locationInRootView = [gesture locationInView:self.view.superview];
|
CGPoint locationInRootView = [gesture locationInView:self.view.superview];
|
||||||
@@ -674,21 +689,8 @@ BOOL isCustomResolution(CGSize res) {
|
|||||||
if (gesture.state == UIGestureRecognizerStateBegan) {
|
if (gesture.state == UIGestureRecognizerStateBegan) {
|
||||||
[self findCapturedStackByTouchLocation:locationInParentStack];
|
[self findCapturedStackByTouchLocation:locationInParentStack];
|
||||||
if(capturedStack == nil) return;
|
if(capturedStack == nil) return;
|
||||||
// actionsheet
|
UIAlertController* actionSheet = [self prepareAddToFavoriteActionSheet];
|
||||||
UIAlertController *actionSheet = [UIAlertController alertControllerWithTitle:nil
|
actionSheet.popoverPresentationController.sourceView = capturedStack;
|
||||||
message:nil
|
|
||||||
preferredStyle:UIAlertControllerStyleActionSheet];
|
|
||||||
UIAlertAction *addFavoriteAction = [UIAlertAction actionWithTitle:[LocalizationHelper localizedStringForKey:@"Add to favorite"]
|
|
||||||
style:UIAlertActionStyleDefault
|
|
||||||
handler:^(UIAlertAction * _Nonnull action) {
|
|
||||||
[self addSettingToFavorite:self->capturedStack];
|
|
||||||
// 在这里执行收藏逻辑
|
|
||||||
}];
|
|
||||||
[actionSheet addAction:addFavoriteAction];
|
|
||||||
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
|
|
||||||
actionSheet.popoverPresentationController.sourceView = self.view;
|
|
||||||
actionSheet.popoverPresentationController.sourceRect = CGRectMake(locationInParentStack.x, locationInParentStack.y, 1, 1);
|
|
||||||
}
|
|
||||||
[self presentViewController:actionSheet animated:YES completion:nil];
|
[self presentViewController:actionSheet animated:YES completion:nil];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user