This repository has been archived by the owner on Nov 18, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 44
/
GKAchievementNotification.h
132 lines (105 loc) · 4.21 KB
/
GKAchievementNotification.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
//
// GKAchievementNotification.h
//
// Created by Benjamin Borowski on 9/30/10.
// Copyright 2010 Typeoneerror Studios. All rights reserved.
// $Id$
//
#import <UIKit/UIKit.h>
@class GKAchievementNotification;
#define kGKAchievementAnimeTime 0.4f
#define kGKAchievementDisplayTime 1.75f
#define kGKAchievementDefaultSize CGRectMake(0.0f, 0.0f, 284.0f, 52.0f);
#define kGKAchievementFrameStart CGRectMake(18.0f, -53.0f, 284.0f, 52.0f);
#define kGKAchievementFrameEnd CGRectMake(18.0f, 10.0f, 284.0f, 52.0f);
#define kGKAchievementText1 CGRectMake(10.0, 6.0f, 264.0f, 22.0f);
#define kGKAchievementText2 CGRectMake(10.0, 20.0f, 264.0f, 22.0f);
#define kGKAchievementText1WLogo CGRectMake(45.0, 6.0f, 229.0f, 22.0f);
#define kGKAchievementText2WLogo CGRectMake(45.0, 20.0f, 229.0f, 22.0f);
#pragma mark -
/**
* The handler delegate responds to hiding and showing
* of the game center notifications.
*/
@protocol GKAchievementHandlerDelegate <NSObject>
@optional
/**
* Called on delegate when notification is hidden.
* @param nofification The notification view that was hidden.
*/
- (void)didHideAchievementNotification:(GKAchievementNotification *)notification;
/**
* Called on delegate when notification is shown.
* @param nofification The notification view that was shown.
*/
- (void)didShowAchievementNotification:(GKAchievementNotification *)notification;
/**
* Called on delegate when notification is about to be hidden.
* @param nofification The notification view that will be hidden.
*/
- (void)willHideAchievementNotification:(GKAchievementNotification *)notification;
/**
* Called on delegate when notification is about to be shown.
* @param nofification The notification view that will be shown.
*/
- (void)willShowAchievementNotification:(GKAchievementNotification *)notification;
@end
#pragma mark -
/**
* The GKAchievementNotification is a view for showing the achievement earned.
*/
@interface GKAchievementNotification : UIView
{
GKAchievementDescription *_achievement; /**< Description of achievement earned. */
NSString *_message; /**< Optional custom achievement message. */
NSString *_title; /**< Optional custom achievement title. */
UIImageView *_background; /**< Stretchable background view. */
UIImageView *_logo; /**< Logo that is displayed on the left. */
UILabel *_textLabel; /**< Text label used to display achievement title. */
UILabel *_detailLabel; /**< Text label used to display achievement description. */
id<GKAchievementHandlerDelegate> _handlerDelegate; /**< Reference to nofification handler. */
}
/** Description of achievement earned. */
@property (nonatomic, retain) GKAchievementDescription *achievement;
/** Optional custom achievement message. */
@property (nonatomic, retain) NSString *message;
/** Optional custom achievement title. */
@property (nonatomic, retain) NSString *title;
/** Stretchable background view. */
@property (nonatomic, retain) UIImageView *background;
/** Logo that is displayed on the left. */
@property (nonatomic, retain) UIImageView *logo;
/** Text label used to display achievement title. */
@property (nonatomic, retain) UILabel *textLabel;
/** Text label used to display achievement description. */
@property (nonatomic, retain) UILabel *detailLabel;
/** Reference to nofification handler. */
@property (nonatomic, retain) id<GKAchievementHandlerDelegate> handlerDelegate;
#pragma mark -
/**
* Create a notification with an achievement description.
* @param achievement Achievement description to notify user of earning.
* @return a GKAchievementNoficiation view.
*/
- (id)initWithAchievementDescription:(GKAchievementDescription *)achievement;
/**
* Create a notification with a custom title and description.
* @param title Title to display in notification.
* @param message Descriotion to display in notification.
* @return a GKAchievementNoficiation view.
*/
- (id)initWithTitle:(NSString *)title andMessage:(NSString *)message;
/**
* Show the notification.
*/
- (void)animateIn;
/**
* Hide the notificaiton.
*/
- (void)animateOut;
/**
* Change the logo that appears on the left.
* @param image The image to display.
*/
- (void)setImage:(UIImage *)image;
@end