Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 目标-C:应为类型错误_Ios_Objective C_Types - Fatal编程技术网

Ios 目标-C:应为类型错误

Ios 目标-C:应为类型错误,ios,objective-c,types,Ios,Objective C,Types,我正试图遵循Nick Kuh的书《iPhone应用程序开发》中的样式表使用教程。样式表头文件正在抛出: “需要一个类型” 我认为这些错误通常反映了一个循环问题。然而,在这种情况下,唯一的进口是基金会。(顺便说一句,实现文件不会抛出任何错误,看起来很好。)下面是完整的头文件 #import <Foundation/Foundation.h> typedef enum : int { IDLabelTypeName = 0, IDLabelTypeBirthdayDat

我正试图遵循Nick Kuh的书《iPhone应用程序开发》中的样式表使用教程。样式表头文件正在抛出:

“需要一个类型”

我认为这些错误通常反映了一个循环问题。然而,在这种情况下,唯一的进口是基金会。(顺便说一句,实现文件不会抛出任何错误,看起来很好。)下面是完整的头文件

#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
#导入
typedef枚举:int{
IDLabelTypeName=0,
IDLabelTypeBirthdayDate,
IDLabelTypeDaySuntil生日,
IDLabelTypeDaysUntilBirthdaySubText,
IDLabelTypeLarge
}
IDLabelType;
@接口IDStyleSheet:NSObject
+(无效)初始样式;
+(void)styleLabel:(UILabel*)标签withType:(IDLabelType)labelType//抛出红色错误
+(void)样式文本视图:(UITextView*)文本视图//抛出红色错误
+(void)styleRoundCorneredView:(UIView*)视图//抛出红色错误
@结束

有人知道为什么会发生这些错误吗?

UILabel
UITextView
。。。是在UIKit框架中定义的,因此您必须

#import <UIKit/UIKit.h>

成功了。所以我想我可以进口基础吗?@ USE12345:是的,UIKit已经包括基金会了。(但如果你离开它也没有坏处。)
@import UIKit;