@property (retain) IBOutlet UISlider *slider;
以上在UISlider前面出现的IBOutlet这个东东,虽然知道这是表示变量与控件的对应关系的,但它的位置很奇怪啊。这个IBOutlet是啥,对象?关键字?

解决方案 »

  1.   

    IBOutlet用来声明一个成员可以链接到xib的一个控件。
    链接之后,对使用IBOutlet声明的成员操作就是对xib中控件的操作。
    其实我觉得就是在初始化IBOutlet声明成员的时候,使用了设计器中链接的控件参数作为参数。官方:
    IBOutlet
    Identifier used to identify a property so Interface Builder can synchronize the display and connection of outlets with Xcode. Insert this identifier immediately before the type in any declarations. For examples, including how to use it with the @property syntax, see “Xcode Integration”
      

  2.   

    一旦标明了IBOutlet,在zib文件里就会有对应的接口
    IBOutlet只是标识而已