iPhone开发-用表格视图显示浮动视图

发布于 2024-07-12 22:29:55 字数 166 浏览 3 评论 0原文

我有一个选项卡栏应用程序,每个选项卡项上都有导航控制器。 我想在选项卡栏上方的表格视图上添加一个浮动(半透明视图)。 我怎样才能达到结果?

结果将类似于 Alpha 列表在联系人应用程序主视图右侧的显示方式。 我希望我能清楚地解释我想做什么。

任何想法? 谢谢。

I have a Tab Bar Application with Navigation Controllers on each Tab Item. I want to add a floating (semi transparent view) on my Table View just above my Tab Bar. How can i achieve the results?

The results will be similar to how the Alpha list is displayed on the right of Contact Application's main view. I hope i'm clear in explaining what i want to do.

Any idea? Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

成熟稳重的好男人 2024-07-19 22:29:56

如果您想要做的只是在表视图上方显示浮动字母(或数字)索引,则只需在 UITableViewDataSource 中定义两个方法:

- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView
- (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index

这些方法提供索引的部分标题的 AZ(或其他)列表,以及在表视图中,每个部分都开始。

对于更自定义的视图,您应该能够创建一个视图,将其背景设置为 [UIColor clearColor],布置其内容,并将其添加为表视图的子视图或作为表视图上方的子视图包含两者的视图。

If all you want to do is display the floating alphabetical (or numerical) index above your table view, you just need to define two methods in your UITableViewDataSource:

- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView
- (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index

These provide the A-Z (or whatever) list of section titles for your index, and where in the table view each section starts.

For a more custom view, you should be able to create a view, set its background to [UIColor clearColor], lay out its contents, and add it as either a subview to the table view or as a subview above the table view in a view that encloses both.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文