Skip to content
Newer
Older
100644 111 lines (61 sloc) 4.63 KB
ceb93f5 @netpro2k initial commit
netpro2k authored
1 GetGlue iPhone Check-in Widget
2 ==============================
3
4 Objective-C wrapper for GetGlue Check-in widgets
5
6
8d64368 @netpro2k Fixed typo in readme
netpro2k authored
7 The simplest way to use the GetGlue Check-in widget is to simply add the code directly to your project. Check-in widgets can then be created either in interface builder, or directly in code. You can see an example of both of these methods in the "Example" project which is provided.
ceb93f5 @netpro2k initial commit
netpro2k authored
8
9 Adding the code to your project
10 -------------------------------
11
12 1. Drag the entire "GetGlueWidget" in the src directory into your project
13
14 2. If you do not want to maintain an external refference to the "GetGlueWidget" directory, you can check "Copy items into destination group's folder (if needed)"
2e0b129 @netpro2k fix image alignment in README
netpro2k authored
15
ceb93f5 @netpro2k initial commit
netpro2k authored
16 ![Copy items dialog](http://cl.ly/7d53f2f6d4833a3682fa/content)
17
18 At this point, your project should compile successfuly, and you are ready to create a GetGlue widget in your application.
19
20 Creating a widget in code
21 -------------------------
22 1. include the GetGlue header
23
24 #import "GetGlueWidget.h"
25
26 2. Create an instance of a GetGlue widget, setting the X and Y values where you would like your widget to appear (Note, GetGlue widgets are always 64x74, reguardles of what width and height are passed in here):
27
28 GetGlueWidgetView* gg2 = [[[GetGlueWidgetView alloc] initWithFrame:CGRectMake(20, 138, 64, 74)] autorelease];
29
30 3. Set the objectKey of the widget to the GetGlue object key the widget should be associated with:
31
32 gg2.objectKey = @"tv_shows/true_blood";
33
34 4. Add the widget to your view:
35
36 [self.view addSubview:gg2];
37
38 Creating a widget via interface builder
39 ---------------------------------------
40 Note: even with widgets created in interface builder, code is still needed to set the GetGlue object key with which the widget is associated.
41
42 1. Open the xib file that contains the view where you would like your widget to appear
43
44 2. Search for "GetGlue" in the "Classes" tab of the "Library" winodw
45
46 ![GetGlue view](http://cl.ly/e64574d981ba99cd509c/content)
47
48 3. Drag an instance of "GetGlueWidgetView" into your view.
49
50 4. With the new GetGlueWidgetView selected, set width to 64 and height to 74 in the "Size" tab of the inspector
51
52 ![Size inspector](http://cl.ly/d3c6e13ff0f723e1c44a/content)
53
54 5. Position the view where you would like your widget to appear
55
56 ![position widget](http://cl.ly/77fad5e630e8361b7f09/content)
57
58 6. You may wish to set the background color of your widget, or make it ransparent, you can do this from the "Attributes" tab of the inspector
59
60 ![attributes](http://cl.ly/6be3d0cad88f0aac03d1/content)
61
62 7. Add an "GetGlueWidgetView" outlet to your xib's view controller (dont forget to import `GetGlueWidget.h`)
63
64 #import "GetGlueWidget.h"
65
66 @interface ExampleViewController : UIViewController {
67 GetGlueWidgetView* gg;
68 }
69
70 @property (nonatomic, retain) IBOutlet GetGlueWidgetView *gg;
71
72 8. In interface builder select your nib's View Controller, and in the "Connections" tab of the inspector, drag a connection from your outlet to the view you created in step 3
73
74 ![connect outlet](http://cl.ly/ecbccb52bc32ba36b2ba/content)
75
76 9. Set the widget's object key in your `viewDidLoad`
77
78 - (void)viewDidLoad {
79 [super viewDidLoad];
80 gg.objectKey = @"tv_shows/weeds";
81 }
82
83
84 Advanced Fetaures
85 =================
86
87 The GetGlue check-in widget has several more advanced features, to help integrate the widget into your application, which can be accessed by implimenting the `GetGlueWidgetDelegate`. The `GetGlueWidgetDelegate` has several callbacks.
88
89 - (void)widget:(GetGlueWidgetView*) widget didPerformCheckinForUser: (NSString*) username
90 -----------------------------------------------------------------------------------------
91
92 Called after a user checks-in. `username` will be the GetGlue username of the user who checked in. The objectKey can be obtained from the widget (`widget.objectKey`)
93
94
95 - (void)widget:(GetGlueWidgetView*) widget didRecieveNewCheckinCount:(int) newCount
96 -----------------------------------------------------------------------------------
97
98 When the widget initially loads, or after a check-in, this method will be called with the number of total check-ins
99
100 - (BOOL)widget:(GetGlueWidgetView*) widget shouldLaunchURL:(NSURL*) url
101 -----------------------------------------------------------------------
102
103 By default, external URLs (such as object pages on getglue.com) are loaded in safari. If you wish to load these in a webview within your own app, you may return `NO` in this delegate, and launch `url` onw your own.
104
105
106
107 Getting Help
108 ============
109
110 If you have any problems integrating GetGlue widgets into your project, you can post to the [GetGlue Development Group](http://groups.google.com/group/glue-development), or email us at support@getglue.com
Something went wrong with that request. Please try again.