开发者

iPhone: "Locking" a Cell to the Top of TableView

开发者 https://www.devze.com 2023-01-12 10:22 出处:网络
I am trying to have a cell at the top of the table always remain there and not scroll down when an object is added i.e. the cell should stay at indexpath.row==0. Is it possible to lock a cel开发者_开发

I am trying to have a cell at the top of the table always remain there and not scroll down when an object is added i.e. the cell should stay at indexpath.row==0. Is it possible to lock a cel开发者_开发百科l to a certain position in a table? If so, how would this be implemented?

EDIT

If i made a different section for this cell that would work wouldnt it?


You can't force a tableview cell to always remain on screen. That would defeat the purpose of having a table in the first place.

Instead, if you need something always displayed in a tableview, you put it in either a the table's header or footer views. Create the view you want and then assign it to the tableview's tableHeaderView or tableFooterView property.


What you probably need is a table's header - check tableHeaderView property in UITableView


I think this isn't possible because tableview is a in uiscrollview, maybe if you add the subView to your navigationController.view?


I found this blog post a useful trick to have static content at the top of a UITableView and allow it to react to touches.

0

精彩评论

暂无评论...
验证码 换一张
取 消