Return to Snippet

Revision: 42444
at March 5, 2011 07:22 by streamt


Initial Code
@interface PurchaseWindowViewController : UIViewController {

	IBOutlet UITableView* listView;
	NSArray* subscriptions;
}



- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
	static NSString *MyIdentifier = @"MyIdentifier";
	
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:MyIdentifier] autorelease];
    }
    cell.textLabel.text = [subscriptions objectAtIndex:indexPath.row];
    return cell;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
	return 4;
}


// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad 
{
	subscriptions = [[NSArray alloc] initWithObjects:@"8 week - $23.92", @"13 week - $38.87", @"26 week - $77.74", @"52 week - $155.48", nil];
	listView.autoresizingMask = UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth;
	[listView reloadData];

}

Initial URL

                                

Initial Description

                                

Initial Title
Create UITableView

Initial Tags
c

Initial Language
Objective C