//
// SampleDay5ViewController.m
// SampleDay5
//
// Created by bit on 11. 5. 20..
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#import "SampleDay5ViewController.h"
@implementation SampleDay5ViewController
@synthesize mTableView;
@synthesize mFamilyList;
@synthesize mFamilyList2;
/*
// The designated initializer. Override to perform setup that is required before the view is loaded.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
*/
/*
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView {
}
*/
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
[super viewDidLoad];
// 죽어 버린 코드
//NSArray *array1 = [[NSArray alloc] arrayWithObjects:@"Jake", @"Tom", @"Jenny", @"Mike", nil];
//self.mFamilyList = array1;
//[array1 release];
//NSArray *array2 = [[NSArray alloc] arrayWithObjects:@"Jake1", @"Tom1", @"Jenny1", @"Mike1", nil];
//self.mFamilyList2 = array2;
//[array2 release];
NSArray *array1 = [NSArray arrayWithObjects:@"Jake", @"Tom", @"Jenny", @"Mike", nil];
self.mFamilyList = array1;
NSArray *array2 = [NSArray arrayWithObjects:@"Jake1", @"Tom1", @"Jenny1", @"Mike1", nil];
self.mFamilyList2 = array2;
}
/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (void)viewDidUnload {
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)dealloc {
[self.mTableView release];
[super dealloc];
}
#pragma mark -
#pragma mark Tableview data source
/*
필수로 만들어 준다.
UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
*/
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if( cell == nil ){
//cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier] autorelease];
}
NSString *text = [mFamilyList objectAtIndex:indexPath.row];
[cell.textLabel setText:text];
NSString *text2 = [mFamilyList2 objectAtIndex:indexPath.row];
[cell.detailTextLabel setText:text2];
return cell;
return nil;
}
/*
필수로 만들어 준다.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
*/
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [mFamilyList count];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
@end
댓글 없음:
댓글 쓰기
참고: 블로그의 회원만 댓글을 작성할 수 있습니다.