2011-09-16 39 views
1

如果我有一个的notificationCenter一个属性的类,并实现与此签名的方法:正确的形式来命名与属性名称冲突的方法参数

-(void)doSomethingWithNotificationCenter:(NSNotificationCenter *)notificationCenter 

Xcode中正确地给我一个错误:

'local declaration of notificationCenter hides instance variable'

所以在Objective C中是否有一个约定来命名这个参数来避免这种冲突?

回答

3

该参数应称为aNotificationCenter或可能aCenter

0

我有时使用格式receivedNotificationCenter或notificationCenterParam。

1

这似乎是个人偏好,我已经看到了上述的aNotificationCenter,NotificationCenter,NotificationCenter等等。我认为只要你在自己的代码中保持一致,任何基本的,可读的选择都是可以的。

PS - 我的个人偏好是在NotificationCenter。