I am trying to follow a tutorial for using a stylesheet from Nick Kuh's book "iPhone App Development". The stylesheet header file is throwing:
我正在尝试按照Nick Kuh的书“iPhone应用程序开发”中的样式表使用教程。样式表头文件抛出:
"Expected a type"
“预期类型”
errors which I think normally reflects a circular problem. However, in this case the only import is to Foundation.h. (The implementation file, btw, does not throw any errors and seems to be fine.) Here is the header file in its entirety.
我认为错误通常反映了一个循环问题。然而,在这种情况下,唯一的导入是Foundation.h。(btw的实现文件不抛出任何错误,看起来很好。)这是完整的头文件。
#import <Foundation/Foundation.h>
typedef enum : int {
IDLabelTypeName = 0,
IDLabelTypeBirthdayDate,
IDLabelTypeDaysUntilBirthday,
IDLabelTypeDaysUntilBirthdaySubText,
IDLabelTypeLarge
}
IDLabelType;
@interface IDStyleSheet : NSObject
+(void)initStyles;
+(void)styleLabel:(UILabel *)label withType:(IDLabelType)labelType;//throws red error
+(void)styleTextView:(UITextView *)textView;//throws red error
+(void)styleRoundCorneredView:(UIView *)view;//throws red error
@end
Can anyone see why these errors are occurring?
有人知道为什么会发生这些错误吗?
1 个解决方案
#1
5
UILabel
, UITextView
... are defined in the UIKit framework, therefore you have to
UILabel UITextView…是在UIKit框架中定义的,所以你必须
#import <UIKit/UIKit.h>
(which then implicitly imports Foundation). You can also use the more modern "module" syntax:
(然后隐式地导入Foundation)。你也可以使用更现代的“模块”语法:
@import UIKit;
#1
5
UILabel
, UITextView
... are defined in the UIKit framework, therefore you have to
UILabel UITextView…是在UIKit框架中定义的,所以你必须
#import <UIKit/UIKit.h>
(which then implicitly imports Foundation). You can also use the more modern "module" syntax:
(然后隐式地导入Foundation)。你也可以使用更现代的“模块”语法:
@import UIKit;