0

我该如何自定义UILocalNotification,以便它可以采用两个整数变量。我试图继承UILocalNotificaion一个类,但是当我访问我添加的两个整数之一时它崩溃了。

@interface AHNotification : UILocalNotification {
    @public
    int AllIndex;
    int Index;
}
@property int AllIndex;
@property int Index;
@end


@implementation AHNotification
@synthesize AllIndex,Index;

-(AHNotification*) init{
    [super init];
    return self;
}

@end
4

1 回答 1

1

使用 UILocalNotification 的内置 userInfo 属性。

例如,您可以在其中存储键值对的 NSDictionary。使用 NSNumber 对象来表示您的整数。

于 2011-10-31T17:48:47.137 回答