Skip to content
Browse files

added UIAlertView category that provides a userInfo property

  • Loading branch information...
1 parent 1cb4b57 commit f5bef93df8e32c9e21ba35c03bb68adf4dde86b3 @Daij-Djan committed Apr 7, 2013
View
13 ui/UIAlertView+UserInfo [ios]/UIAlertView+UserInfo.h
@@ -0,0 +1,13 @@
+//
+// UIAlertView (UserInfo)
+// DecisionMaker
+//
+// Created by Dominik Pich on 01.04.13.
+// Copyright (c) 2013 Dominik Pich. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface UIAlertView (UserInfo)
+@property (nonatomic, assign) NSDictionary* userInfo;
+@end
View
24 ui/UIAlertView+UserInfo [ios]/UIAlertView+UserInfo.m
@@ -0,0 +1,24 @@
+//
+// UIAlertView (UserInfo)
+// DecisionMaker
+//
+// Created by Dominik Pich on 01.04.13.
+// Copyright (c) 2013 Dominik Pich. All rights reserved.
+//
+
+#import "UIAlertView+UserInfo.h"
+#import <objc/runtime.h>
+
+@implementation UIAlertView (UserInfo)
+
+#define kUserInfoKey @"DDUserInfo"
+
+- (void)setUserInfo:(NSDictionary *)userInfo {
+ objc_setAssociatedObject(self, kUserInfoKey, userInfo, OBJC_ASSOCIATION_RETAIN);
+}
+
+- (NSDictionary *)userInfo {
+ return objc_getAssociatedObject(self, kUserInfoKey);
+}
+
+@end

0 comments on commit f5bef93

Please sign in to comment.
Something went wrong with that request. Please try again.