@interface が 2 回表示されるのはなぜですか (作成したこの UIViewController ファイルの .h および .m ファイル内。
.h ファイル
@interface BlackTimer : UIViewController
@end
.m ファイル
@interface ViewController ()
@end
@interface が 2 回表示されるのはなぜですか (作成したこの UIViewController ファイルの .h および .m ファイル内。
.h ファイル
@interface BlackTimer : UIViewController
@end
.m ファイル
@interface ViewController ()
@end
通常、.m ファイルには、プライベート メソッドのすべての宣言を入れます。
次のように「プライベート」(またはそれに類似したもの) という単語を書くのは良い使い方です。
@interface ViewController (private)
-(void)myPrivateMethod;
@end
実装ファイル (.m)の@interface ViewController ()
定義は匿名のカテゴリです。パブリック インターフェイス (.h) をインポートする他のオブジェクトにそれらを公開することなく、クラスが実装する ivar、プロパティ、およびメッセージを定義できます。