gpt4 book ai didi

ios - 在 UISwipeActionsConfiguration iOS 11 中更改文本和图像的颜色 - Xamarin/Swift

转载 作者:可可西里 更新时间:2023-11-01 03:34:51 26 4
gpt4 key购买 nike

我有这个适用于 iOS 11 的 UISwipeActionsConfiguration 这个代码看起来像

enter image description here

public override UISwipeActionsConfiguration GetLeadingSwipeActionsConfiguration(UITableView tableView, NSIndexPath indexPath)
{
var definitionAction = ContextualDefinitionAction(indexPath.Row);
var flagAction = ContextualFlagAction(indexPath.Row);
var leadingSwipe = UISwipeActionsConfiguration.FromActions(new UIContextualAction[] { flagAction, definitionAction });

leadingSwipe.PerformsFirstActionWithFullSwipe = false;
return leadingSwipe;
}


public UIContextualAction ContextualDefinitionAction(int row)
{
string word = words[row];

var action = UIContextualAction.FromContextualActionStyle(UIContextualActionStyle.Normal,
"Definition",
(ReadLaterAction, view, success) => {
var def = new UIReferenceLibraryViewController(word);

var alertController = UIAlertController.Create("No Dictionary Installed", "To install a Dictionary, Select Definition again, click `Manage` on the next screen and select a dictionary to download", UIAlertControllerStyle.Alert);
alertController.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, null));

if (UIReferenceLibraryViewController.DictionaryHasDefinitionForTerm(word) || hasViewedAlert == true){
PresentViewController(def, true, null);
success(true);
}else{
PresentViewController(alertController, true, null);
hasViewedAlert = true;
success(false);
}
});
action.BackgroundColor = UIColor.Orange;
return action;
}

public UIContextualAction ContextualFlagAction(int row)
{
var action = UIContextualAction.FromContextualActionStyle(UIContextualActionStyle.Normal,
"Flag",
(FlagAction, view, success) => {
var alertController = UIAlertController.Create($"Report {words[row]}?", "", UIAlertControllerStyle.Alert);
alertController.AddAction(UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, null));
alertController.AddAction(UIAlertAction.Create("Yes", UIAlertActionStyle.Destructive, null));
PresentViewController(alertController, true, null);

success(true);
});

action.Image = UIImage.FromFile("feedback.png");
action.BackgroundColor = UIColor.Blue;

return action;
}

存在修改文本和图像颜色的方法吗?因为我不知道,所以我尝试在用户滑动时在单元格上创建一个 ImageView,但图像位于滑动 View 的后面。感谢您的帮助,希望您能帮我解决这个问题。

最佳答案

实际上用API修改UISwipeActionsConfiguration来改变文字和图片的颜色是不可能的。

关于ios - 在 UISwipeActionsConfiguration iOS 11 中更改文本和图像的颜色 - Xamarin/Swift,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46710664/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com