1

プロトタイプセルを使用してTableViewを作成しました。tableViewの最初の位置で私はこれを作りました

override func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
    if section == 0
    {
        let view : UIView = UIView(frame: CGRectMake(0, 0, 400, 140))
        view.backgroundColor = UIColor.redColor()
        view.addSubview(populateView())
        //populateView() is a method by which I programmatically made all object in the view (label, images, textView)
        return view
    }
    else
    {
        return nil
    }
}

override func tableView(tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat
{
    if section == 0
    {
        return 140
    } else
    {
        return 0
    }
}

結果はこれです(これはテストです): スクリーンショット

ここで、TableHeaderView を tableView でスクロールしないようにしたいと思います。tableView スタイルをプレーンにしました。そして、このUITableViewセクションヘッダーのデフォルトスクロール動作の変更とこれを見つけましたhttps://corecocoa.wordpress.com/2011/09/17/how-to-disable-floating-header-in-uitableview/しかし、わかりませんObjective-c (私はわずか 6 か月からの迅速なプログラマーです)。誰でも私の問題を解決できますか?

4

2 に答える 2