0

我想创建我的类别类别的对象。我是 iphone 开发新手,不知道该怎么做。它是我的类 .h 文件 Category.h

@interface 类别:NSObject

@property (nonatomic, 保留) NSString *uid; @property (nonatomic, 保留) NSString *title;

@结尾

在java中它可以做到。类别类别 = 新类别();

4

3 回答 3

0
Category *category = [Category alloc]init];
于 2013-02-28T05:34:45.303 回答
0

在 .h 文件中导入“Category.h”

现在我们已经通过这样写来为其分配内存

Category * categoryObj = [[Category alloc] init];

现在我们可以在你想要的地方使用那个对象,就像这个
categoryObj.uid = @"your data";
categoryObj.title = @"你的数据";

我希望这能帮到您

于 2013-02-28T05:36:25.297 回答
0

在 Objective-c 中,我们像这样创建对象:

类别 * categoryObject = [[类别分配] init];

现在您可以插入如下数据:

类别对象。uid=@"2356-4fr5-ok8u-52o8-85ki-km76-l5bt-09ij-kf65-8ij6";

类别对象。title=@"示例项目";

享受编码

于 2013-02-28T05:42:35.170 回答