-
Notifications
You must be signed in to change notification settings - Fork 5
/
WidgetContact.m
executable file
·76 lines (59 loc) · 2.16 KB
/
WidgetContact.m
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
//
// WidgetContact.m
// TodayScreen
//
// Created by Mac Pro on 5/24/09.
// Copyright 2009 __MyCompanyName__. All rights reserved.
//
#import "WidgetContact.h"
@implementation WidgetContact
@synthesize contactsArray;
-(id) initWithSuperTableController:(UITableViewController*)superViewController {
if (self = [super init]) {
tableViewController = superViewController;
[tableViewController retain];
contactsArray = [[NSMutableArray alloc] init];
contacts[0].name = @"min ming";
contacts[1].name = @"shravan";
contacts[2].name = @"steve";
contacts[3].name = @"james";
contacts[4].name = @"george";
}
return self;
}
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor clearColor];
for (int i=0; i<5; i++) {
if ([contacts[i].name length] > 0) {
contact = [[WidgetComponent_Contact alloc] init];
[self.view addSubview:contact.view];
contact.view.frame = CGRectMake(i*60.0+10.0, 10.0, 60.0, 50.0);
contact.button.tag = i;
//[contact setContact:contacts[i].name];
//[contact.button setTitle:contacts[i].name forState:UIControlStateNormal];
//if (contacts[i].image != nil) {
// [contact.button setImage:[self getImageFromUrl:contacts[i].image] forState:UIControlStateNormal];
//}
//id path = @"http://merrimusings.mu.nu/archives/images/groundhog2.jpg";
//NSURL *url = [NSURL URLWithString:path];
//NSData *data = [NSData dataWithContentsOfURL:url];
//UIImage *img = [[UIImage alloc] initWithData:data cache:NO];
//[contact.button addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchDown];
[contact.view setNeedsLayout];
[self.contactsArray addObject:contact]; // this will keep the pointer to imageView intact for use later
[contact release];
}
}
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview
// Release anything that's not essential, such as cached data
}
- (void)dealloc {
[tableViewController release];
[contactsArray release];
[super dealloc];
}
@end