如何自定义UILocalNotification? XCode iPhone

时间:2011-05-08 23:23:49

标签: objective-c xcode notifications uilocalnotification

我如何自定义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

1 个答案:

答案 0 :(得分:1)

使用UILocalNotification的内置userInfo属性。

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