여기에 뭔가가 누락 될 수 있지만 수동으로 행 선택을 취소 할 때 Element
클래스에서 트리거하도록 Deselect
이벤트를 가져올 수 없습니다. 일부 사용자 지정 드로잉을 수행 할 셀을 재정의하고 셀을 선택/선택 해제 할 때 글꼴 색을 변경하려고합니다.TableView.DeselectRow가 트리거되지 않음 사용자 정의 요소에 대해 선택 취소 된 이벤트
실제 문제의 실제 예는 아래에 설명되어 있습니다.
public class TestViewController : DialogViewController
{
public TestViewController() : base(UITableViewStyle.Plain, null, true)
{
Root = new RootElement(null);
var section = new Section();
for (int i = 0; i <= 10; i++)
{
var element = new MyCustomElement();
element.Tapped += (dvc, tableView, indexPath) => {
var sheet = new UIActionSheet("", null, "Cancel", null, null);
sheet.Dismissed += delegate(object sender, UIButtonEventArgs e) {
tableView.DeselectRow(indexPath, false);
};
sheet.ShowInView(View);
};
section.Add (element);
}
Root.Add (section);
}
}
public class MyCustomElement : Element, IElementSizing {
static NSString mKey = new NSString ("MyCustomElement");
public MyCustomElement() : base ("")
{
}
public MyCustomElement (Action<DialogViewController,UITableView,NSIndexPath> tapped) : base ("")
{
Tapped += tapped;
}
public override UITableViewCell GetCell (UITableView tv)
{
var cell = tv.DequeueReusableCell (mKey);
if (cell == null)
cell = new UITableViewCell (UITableViewCellStyle.Default, mKey);
return cell;
}
public float GetHeight (UITableView tableView, NSIndexPath indexPath)
{
return 65;
}
public event Action<DialogViewController, UITableView, NSIndexPath> Tapped;
public override void Selected (DialogViewController dvc, UITableView tableView, NSIndexPath path)
{
Console.WriteLine("Selected!");
if (Tapped != null)
Tapped (dvc, tableView, path);
}
public override void Deselected (DialogViewController dvc, UITableView tableView, NSIndexPath path)
{
// does not trigger when deselect manually invoked
Console.WriteLine("Deselected!");
base.Deselected (dvc, tableView, path);
}
}
나는 또한 DialogViewController
자체를 Deselected
이벤트를 무시하고 심지어 사용자 정의 Source
를 만들고 거기에 RowDeselected
이벤트를 재정의하는 시도했지만 그것은 여전히 트리거 아니에요. 내가 트리거 할 수있는 유일한 방법은 Tapped
핸들러를 제거하고 다른 셀을 선택하는 것입니다.
DeselectRow
를 호출 한 후 자동으로 업데이트 할 수있는 요소를 강요 지금 뭐하는 거지 문제를 해결하기 위해, 그러나, 나는 그것이 게재하고 있지 않습니다
이유 알고 싶습니다.
한계가 약간 나타난다면 생각하지 않습니까? 표시된 예제에서 알 수 있듯이 목록보기에서 항목을 수동으로 선택 취소하려는 확실한 예가 있습니다. 알림을 보낼 * 목록에서 항목을 선택 취소하는 다른 방법이 있습니까? – James
모토 터치 디 로그가 아니라 ios 제한 사항. tableView : didDeselectRowAtIndexPath : monotouch 대화 상자가 대상 요소에 대해 선택 취소 된 이벤트를 호출하면 표시되지만 tableView.DeselectRow (indexPath, false)를 호출하면 tableource가 tableView : didDeselectRowAtIndexPath :를 수신하지 않고 deselected 이벤트가 호출되지 않습니다. 선택을 제거하고 요소의 선택 해제 이벤트를 호출하는 함수를 만들 수 있습니다. –
"*가 나타날 때 tableView : didDeselectRowAtIndexPath : 대상 요소에 대해 선택 취소 된 이벤트라는 모노 아웃 대화 상자 *"가 무슨 뜻인지 이해가 확실하지 않습니까? 'DeselectRow'는 배후에서 네이티브'didDeselectRowAtIndexPath'를 호출합니다. – James