亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

新手提問:Objective-C中在@implementation上加一個(gè)@interface的有什么不同?
伊謝爾倫
伊謝爾倫 2017-04-21 11:16:01
0
2
694

新手提問,看別人的代碼是這樣寫的:

@interface FirstViewController() 
-(void)timerOnActive;
-(void)getDataFromCD;
@end

@implementation FirstViewController
@synthesize userID;
@synthesize timer;

上面的代碼是寫在.m文件里的,我的問題是為什么不把

@interface FirstViewController() 
-(void)timerOnActive;
-(void)getDataFromCD;
@end

寫在.h文件的@interface中? FirstViewController() 后面的那個(gè)括號(hào)是空的,需要填什么嗎?這樣寫是為了補(bǔ)充嗎?

伊謝爾倫
伊謝爾倫

小伙看你根骨奇佳,潛力無限,來學(xué)PHP伐。

reply all(2)
Peter_Zhu

The @interface FirstViewController() here is actually a class extension, just like an anonymous category. The methods it declares must be implemented in the main @implementation code block of the corresponding class. A class may have a publicly declared API , while having additional methods declared as private for use only by the class or framework class. You can declare such a method using a category (or more than one category) in a private header file or implementation file mentioned above. This works, but the compiler cannot confirm that all declared methods are implemented.

小葫蘆

The method written in the m file cannot be called by external classes. This method is treated as a private method and called within this class. It is hidden from the outside world.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template