我正在尝试下一个方式:
Message *message = self.messagesArray[indexPath.row];
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:LocalizedString(@"FirstAction")
message:@""
preferredStyle:UIAlertControllerStyleActionSheet];
UIAlertAction *editMessage = [UIAlertAction actionWithTitle:LocalizedString(@"SecondAction") style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
}];
[alertController addAction:editMessage];
UIAlertAction *forwardMessage = [UIAlertAction actionWithTitle:LocalizedString(@"ThirdAction") style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
}];
[alertController addAction:forwardMessage];
UIAlertAction *deleteMessage = [UIAlertAction actionWithTitle:LocalizedString(@"DeleteMessage") style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
}];
[alertController addAction:deleteMessage];
[self setSourceViewForAlertController:alertController];
[self presentViewController:alertController animated:YES completion:nil];
[self createMenuForMessage:message];
[[UIMenuController sharedMenuController] setMenuVisible:YES animated:YES];
所以,我的目标是同时为UICollectionViewCell和UIMenuController提供alertcontroller。
答案 0 :(得分:1)
您的问题与 void Update()
{
Movement();
}
void Movement()
{
physicPlayer.velocity = Vector2.zero;
if (Input.GetKey(KeyCode.LeftArrow) && transform.position.x >= -moveRangeX)
physicPlayer.velocity = new Vector2(-moveSpeed, physicPlayer.velocity.y);
if (Input.GetKey(KeyCode.RightArrow) && transform.position.x <= moveRangeX)
physicPlayer.velocity = new Vector2(moveSpeed, physicPlayer.velocity.y);
if (Input.GetKey(KeyCode.UpArrow) && transform.position.y <= moveRangeY)
physicPlayer.velocity = new Vector2(physicPlayer.velocity.x, moveSpeed);
if (Input.GetKey(KeyCode.DownArrow) && transform.position.y >= -moveRangeY)
physicPlayer.velocity = new Vector2(physicPlayer.velocity.x, -moveSpeed);
}
您必须考虑UIMenuController
必须实施UIView
方法返回canBecomeFirstResponder
YES