有一代码如下:
@class tabbarView;
@interface tabbarViewController : UIViewController
@property(nonatomic,strong) tabbarView *tabbar; //注意看这一行,这里 tabbar 前面没有下划线
@property(nonatomic,strong) NSArray *arrayViewcontrollers;
@end
再看下面这个实现,在 tabbar 前面为什么要加个下划线呢?( 变成了 _tabbar )@implementation tabbarViewController
- (void)viewDidLoad
{
    [super viewDidLoad];
    //以下行中 tabbar 前面都加了下划线,不知为啥?
    _tabbar = [[tabbarView alloc]initWithFrame:CGRectMake(0,  960, 320, 60)];
    _tabbar.delegate = self;
    [self.view addSubview:_tabbar];  
}
谢谢各位!

解决方案 »

  1.   


    @class tabbarView;
    @interface tabbarViewController : UIViewController
    @property(nonatomic,strong) tabbarView *tabbar; //注意看这一行,这里 tabbar 前面没有下划线
    @property(nonatomic,strong) NSArray *arrayViewcontrollers;
    @end在这段代码之前,应该有如下代码@interface tabbarViewController : UIViewController
    {
        tabbarView *_tabbar;
    }
    @end实现中应该有如下代码@implementation tabbarViewController
    @synthesize tabbar = _tabbar;
      

  2.   

    谢谢各位,尤其 tongleicsd !
      

  3.   

    各位有空的话,请顺便帮我看看这个问题:
    http://bbs.csdn.net/topics/390462265
      

  4.   

    oc 中  get set的原因