0
テーブルビューで、バウンスを無効にすると、テーブルビューをオーバースクロールした後にdidSelectRowAtIndexPath()
デリゲートを検出することができます。バウンスが有効になっていると、スクロールに関するテーブルビューの開始と終了に空白が表示され、セルのタップで呼び出されるdidSelectRowAtIndexPath()
デリゲートが表示されます。ユーザーがスクロールオーバーしようとした後にセルをダブルタップして選択する方法はありますか?テーブルビューでバウンスを無効にすると、オーバースキャンしようとした後にセルを2回タップします。
コード
のViewController
public partial class MyViewController : UIViewController
{
public MyViewController() : base("MyViewController", null)
{
}
public override void ViewDidLoad()
{
base.ViewDidLoad();
sampletable.Source = new TableSource();
}
}
表ソース
public class TableSource :UITableViewSource
{
string[] data = new string[] { "one", "two", "three", "four", "five" };
string[] header = new string[] { "Header1", "Header2", "Header3", "Header4", "Header5" };
public TableSource()
{
}
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
{
var cell = (MyTableViewCell)tableView.DequeueReusableCell(MyTableViewCell.Key);
if (cell == null)
{
cell = MyTableViewCell.Create();
}
cell.data = data[indexPath.Row];
return cell;
}
public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
{
Console.WriteLine(header[indexPath.Section] + "->" + data[indexPath.Row]);
}
public override nint RowsInSection(UITableView tableview, nint section)
{
return data.Length;
}
public override nint NumberOfSections(UITableView tableView)
{
return header.Length;
}
public override string TitleForHeader(UITableView tableView, nint section)
{
return header[section];
}
public override nfloat GetHeightForHeader(UITableView tableView, nint section)
{
return 50;
}
}
セル
public partial class MyTableViewCell : UITableViewCell
{
public static readonly NSString Key = new NSString("MyTableViewCell");
public static readonly UINib Nib;
public string data { get; set; }
static MyTableViewCell()
{
Nib = UINib.FromName("MyTableViewCell", NSBundle.MainBundle);
}
protected MyTableViewCell(IntPtr handle) : base(handle)
{
// Note: this .ctor should not contain any initialization logic.
}
public static MyTableViewCell Create()
{
return (MyTableViewCell)Nib.Instantiate(null, null)[0];
}
public override void LayoutSubviews()
{
countLabel.Text = data;
}
}
私はインターフェイスビルダーで
更新バウンス、バウンス垂直およびバウンス水平のチェックボックスをオフに:こんにちは、私は、解決策を見つけたネイティブのiOSスウィフトバージョンコード
Here is the Native iOS Swift Version Code
@matt私はswiftを使って同じものを実装しようとしましたが、私は同じ問題を抱えていました。スウィフトコード – RikudouSennin
のリンクを追加Xcode 9ベータ版でこの問題を再現できる場合は、Appleにバグを提出することをお勧めします。 – matt
私はdownvoteの理由を知っていますか?私のコードの問題点は何ですか? – RikudouSennin