首页 > 代码库 > UIBarButtonItem

UIBarButtonItem

一个bar button item是专门用来放在uitoolbar 和uinavigationbar上的对象。他继承自UIBarItem。UIBarButtonItem定义了额外的初始化方法和属性用于再toolbars喝navigation bars上。

Initializing an Item

  • – initWithBarButtonSystemItem:target:action:
  • – initWithCustomView:
  • – initWithImage:style:target:action:
  • – initWithTitle:style:target:action:
  • – initWithImage:landscapeImagePhone:style:target:action:

Getting and Setting Properties

  • target  property
  •    action  property
  •    style  property
  •    possibleTitles  property
  •    width  property  如果此值为正的,宽度固定,为0或负数,按照标题、图像大小来定宽度。默认为0
  •    customView  property

Customizing Appearance

  •  tintColor  property
  • – backButtonBackgroundImageForState:barMetrics:
  • – setBackButtonBackgroundImage:forState:barMetrics:
  • – backButtonTitlePositionAdjustmentForBarMetrics:
  • – setBackButtonTitlePositionAdjustment:forBarMetrics:
  • – backButtonBackgroundVerticalPositionAdjustmentForBarMetrics:
  • – setBackButtonBackgroundVerticalPositionAdjustment:forBarMetrics:
  • – backgroundVerticalPositionAdjustmentForBarMetrics:
  • – setBackgroundVerticalPositionAdjustment:forBarMetrics:
  • – backgroundImageForState:barMetrics:
  • – setBackgroundImage:forState:barMetrics:
  • – backgroundImageForState:style:barMetrics:
  • – setBackgroundImage:forState:style:barMetrics:
  • – titlePositionAdjustmentForBarMetrics:
  • – setTitlePositionAdjustment:forBarMetrics: