iOS UI Element Usage

  1.  Bars
  • The Status Bar

The UIStatusBarStyle constant, controls the status bar style.
To specify the status bar style, you set a value in your Info.plist file. (For more information about the
contents of this file, see “UIKit Keys”; to learn how to set values, see Property List Editor Help .)

一般不建议自定义状态栏,主要考虑到兼容性

On iPhone, specify the color of the status bar. You can choose gray (the default color), opaque black, or
translucent black (that is, black with an alpha value of 0.5).

Be sure to choose a status bar appearance that coordinates with the rest of your iPhone app. For example,
avoid using a translucent status bar if the navigation bar is opaque. 避免使用同名的状态栏如果导航栏不是透明的。
On iPhone, set whether the change in status bar color should be animated. Note that the animation causes
the old status bar to slide up until it disappears off the screen while the new status bar slides into place.

  • Navigation Bar  UINavigationBar

A navigation bar enables navigation through an information hierarchy and, optionally, management of screen
contents.A navigation bar is contained in a navigation controller, which is an object that manages the display of your
hierarchy of custom views

 

On iPhone, changing the device orientation from portrait to landscape can change the height of the navigation
bar automatically. On iPad, the height and translucency of a navigation bar doesn’t change with rotation.
On iPhone, a navigation bar always displays across the full width of the screen. On iPad, a navigation bar can
display within a view—such as one pane of a split view—that doesn’t extend across the screen.

在iphone中如果改变设备的方向会自动改变状态条的高度。而在ipad中状态条的高度和透明度时不会随着旋转而改变的。iphone中状态条的宽度总是全屏的宽度,

在ipad中,状态条却是可以显示在一个视图中的。

  • Use the title of the current view as the title of the navigation bar.
  • Use system-provided buttons according to their documented meaning.
  • If appropriate, customize the appearance of a navigation bar to coordinate with the look of your app.
  • If appropriate, customize the appearance of navigation-bar controls.
  • Make sure that a customized back button still looks like a back button.

On iPhone, be prepared for the change in navigation bar height that occurs on device rotation. In particular,
make sure that your custom navigation bar icons fit well in the thinner bar that appears in landscape orientation.
Don’t specify the height of a navigation bar programmatically; instead, you can take advantage of the
UIBarMetrics constants to ensure that your content fits well.

在iphone中注意横屏时导航栏的高度变化,不要在程序中指定导航栏的高度,而是可以利用UIBarMetrics来使得内容适配。

  • Toolbar UIToolbar

A toolbar contains controls that perform actions related to objects in the screen or view.

A toolbar is typically contained in a navigation controller, which is an object that manages the display of a
hierarchy of custom views. toolbar一般都会嵌入到navigation controller中

On iPhone, a toolbar always appears at the bottom edge of a screen or view, but on iPad it can instead appear
at the top edge. 在iphone中经常出现在屏幕或者视图的下方,但是在ipad中却是可以显示在上方的。

On iPhone, changing the device orientation from portrait to landscape can change the height of the toolbar
automatically. On iPad, the height and translucency of a toolbar don’t change with rotation.

iphone中屏幕旋转会改变工具条的高度,但是在ipad中却不会改变

 

  1. Maintain a hit target area of at least 44 x 44 points for each toolbar item. If you crowd toolbar items too closely together, people have difficulty tapping the one they want.
  2. On iPhone, be prepared for the change in toolbar height that occurs on device rotation
  • Tab Bar  UITabBar

On iPhone, a tab bar can display no more than five tabs at one time; if the app has more tabs, the tab bar
displays four of them and adds the More tab, which reveals the additional tabs in a list. On iPad, a tab bar can
display more than five tabs.

在iphone中tab bar只能一次显示5个tabs,如果有多余的会显示more tab,而ipad中却是可以显示超过5个tab的

 

  • Don’t use a tab bar to give users controls that act on elements in the current mode or screen

   2, Content Views

  • Create a streamlined image that represents your service.
  • Create the image in the following sizes:

For iPhone and iPod touch: About 43 x 43 pixels  About 86 x 86 pixels (high resolution)
For iPad:About 55 x 55 pixels About 110 x 110 pixels (high resolution)

  • Image View UIImageView
  • Scroll View UIScrollView
  1. A scroll view helps people see content that is larger than the scroll view’s boundaries (the image shown below is both taller and wider than the scroll view that contains it).
  2. Support zoom behavior appropriately.
  3. Consider using a page control with a paging-mode scroll view.
  4. In general, display only one scroll view at a time.
  • Split View(iPad Only) UISplitViewController

A split view is a full-screen view that consists of two side-by-side panes.

  • Table View UITableView

A table view presents data in a single-column list of multiple rows.

 

 

  • Plain tables

 

  • Grouped tables

  • Text View  UITextView
  • Web View   UIWebView
  • Alerts, Action Sheets, and Modal Views
  • An action sheet displays a set of choices related to a task the user initiates (shown below on iPhone). UIActionSheet

An action sheet has two different appearances. On iPhone, an action sheet always emerges from the bottom
of the screen and hovers over the app’s views (an action sheet for Safari on iPhone is shown above). The side
edges of an action sheet are anchored to the sides of the screen, which reinforces its connection to the app
and to the user’s most recent action.

On iPad, an action sheet is always displayed within a popover; it never has full-screen width (to learn more
about popovers, see “Popover (iPad Only)” (page 144)). An action sheet can cause a popover to appear, or it
can appear within a popover that’s already open. In both cases, there’s a strong visual connection between
the action sheet and the user’s action. For example, the action sheet shown here is displayed when the user
taps the Mail Reply button on iPad.

On iPhone, coordinate the action sheet background appearance with the navigation bars and toolbars.

On iPhone, include a Cancel button so that users can easily and safely abandon the task

On iPad, choose whether to display an action sheet with animation or without animation.

Avoid making users scroll through an action sheet.

On both devices, use the red button color if a potentially destructive action can be performed.

  1. Controls

Activity Indicator UIActivityIndicatorView
An activity indicator shows that a task or process is progressing (shown here with a label).

Date Picker UIDatePicker

A date picker displays components of date and time, such as hours, minutes, days, and years.

你可能感兴趣的:(element)