gpt4 book ai didi

objective-c - XCode 4.2 为什么我在 .h 和 .m 文件中看到 @interface

转载 作者:可可西里 更新时间:2023-11-01 03:28:11 25 4
gpt4 key购买 nike

为什么我在我创建的这个 UIViewController 文件中的 .h 和 .m 文件中看到两次 @interface(在 .m 中的那个看起来像一个构造函数。是吗?

.h文件

@interface BlackTimer : UIViewController 


@end

.m文件

@interface ViewController ()

@end

最佳答案

通常在 .m 文件中放置所有私有(private)方法的声明

像这样写“私有(private)”(或类似的东西)这个词是一个很好的用法:

@interface ViewController (private)

-(void)myPrivateMethod;

@end

关于objective-c - XCode 4.2 为什么我在 .h 和 .m 文件中看到 @interface,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10928372/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com