开发者

How do I get a disclosure indicator in my tableview header section?

开发者 https://www.devze.com 2023-04-09 15:54 出处:网络
I\'m customizing my headers in my Tableview and I want to add a discloure indicator (arrow) to my header that is clickable, is that po开发者_JAVA百科ssible?If you already customized your header view y

I'm customizing my headers in my Tableview and I want to add a discloure indicator (arrow) to my header that is clickable, is that po开发者_JAVA百科ssible?


If you already customized your header view you can simply add a custom UIButton with an image of a discloure indicator add add it as a subview to your header view.

If you need further help you are most welcome.

EDIT Jonathan is right, the UIButton has a UIButtonTypeDetailDisclosure so there is no need for a custom image.


You can fetch the header view using

- (void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger)section

Then fetch the actual header view

UITableViewHeaderFooterView *header = (UITableViewHeaderFooterView *)view;

Create a button with detail disclosure

UIButton *button = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];

Then set the frame of this button and add it to the header view

0

精彩评论

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

关注公众号