如何创建类似iPhone设置的视图 [英] How to create a iPhone Settings-like view

查看:100
本文介绍了如何创建类似iPhone设置的视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个类似于iPhone设置应用的视图。

I want to create a view similar to the iPhone's Settings app.

这个视图是使用UITableView还是什么?这些项是以编程方式创建的还是可以在Interface Builder中执行此操作?

Is this view using a UITableView or what? Are the items created programmatically or is it possible to do this in Interface Builder?

推荐答案

这是一个带样式的UITableView:UITableViewStyleGrouped

It is a UITableView with style: UITableViewStyleGrouped

可以在界面构建器中执行此操作,并且有多种方法。

It is possible to do so in Interface builder and there are a number of ways.

本文介绍Google搜索提供的最直观的方式: http://www.galloway.me。英国/教程/ custom-uitableviewcell /

This article describes the most intuitive way a Google search has to offer: http://www.galloway.me.uk/tutorials/custom-uitableviewcell/

关键步骤是:


  • 用xib创建UIViewController(不是表视图控制器)

  • 用UITableView替换它的初始视图

  • 实现UITableViewDelegate和UITableViewDatasource协议

  • 将任何其他UITableViewCell添加到Interface Builder作为额外视图

  • 在视图控制器类中将它们称为 IBOutlet UITableViewCell *

  • 使用连接检查器将视图控制器中的IBOutlet连接到Interface Builder中的单元格

  • Create UIViewController with xib (not table view controller)
  • replace it's initial view with a UITableView
  • implement UITableViewDelegate and UITableViewDatasource protocols
  • add any additional UITableViewCells to Interface Builder as extra views
  • refer to them in your view controller class as IBOutlet UITableViewCell *
  • use connections inspector to connect IBOutlets in view controller to cells in Interface Builder

这篇关于如何创建类似iPhone设置的视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆