.m파일
@synthesize mamberTable;
//테이블 뷰의 셀의 수를 지정하는 함수
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return getMemberLisData.count;
}
//테이블 뷰의 셀을 세팅하는 함수
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString* SimpleTableIdemtofoer = @"SimpleTableIdemtofoer";
UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:SimpleTableIdemtofoer];
if(cell == nil){
cell = [[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:SimpleTableIdemtofoer]autorelease];
}
NSUInteger row;
// 여러개의 테이블 뷰를 사용할 경우 셀을 tag값으로 구분하여 각각 다른 셀을 입력 할 수 있다.
if(tableView.tag==0){
row = [indexPath row];
cell.textLabel.text = [bildingName objectAtIndex:row];
cell.textLabel.font = [UIFont boldSystemFontOfSize:16];
}else if(tableView.tag==1){
row = [indexPath row];
cell.textLabel.text = [selectTime objectAtIndex:row];
cell.textLabel.font = [UIFont boldSystemFontOfSize:16];
}else if(tableView.tag==2){
row = [indexPath row];
cell.textLabel.text = [memberCount objectAtIndex:row];
cell.textLabel.font = [UIFont boldSystemFontOfSize:16];
}else if(tableView.tag==3){
row = [indexPath row];
if([[bildingLevel objectAtIndex:row] isEqualToString:@"지하2층"]){
cell.textLabel.font = [UIFont boldSystemFontOfSize:13];
//[cell.textLabel sizeToFit];
cell.textLabel.text = [bildingLevel objectAtIndex:row];
//[cell.textLabel sizeToFit];
}else{
cell.textLabel.text = [bildingLevel objectAtIndex:row];
cell.textLabel.font = [UIFont boldSystemFontOfSize:16];
}
}
return cell;
}
//테이블 뷰 셀 클릭 이벤트 호출 함수
-(NSIndexPath*)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath{
NSUInteger row = [indexPath row];
switch (tableView.tag) {
case 0:
if ( [selectListViewDelegate respondsToSelector:@selector(settingSite:)] )
{
[selectListViewDelegate settingSite:[bildingName objectAtIndex : [indexPath row]]];
}
break;
case 1:
if ( [selectListViewDelegate respondsToSelector:@selector(settingTime:)] )
{
[selectListViewDelegate settingTime:[selectTime objectAtIndex : [indexPath row]]];
}
break;
case 2:
if ( [selectListViewDelegate respondsToSelector:@selector(settingMemberCount:)] )
{
[selectListViewDelegate settingMemberCount:[memberCount objectAtIndex : [indexPath row]]];
}
break;
case 3:
if ( [selectListViewDelegate respondsToSelector:@selector(settingBuildingLevelCount:)] )
{
[selectListViewDelegate settingBuildingLevelCount:[bildingLevel objectAtIndex : [indexPath row]]];
}
break;
default:
break;
}
[self removeFromSuperview];
return indexPath;
}
'iPhone' 카테고리의 다른 글
URL Schemes로 다른 어플 호출하기 (0) | 2012.06.07 |
---|---|
테이블 뷰 셀 커스텀 적용 부분 (2) | 2012.05.24 |
텍스트뷰 포커스 이동 이벤트, 텍스트뷰 클릭 이벤트 (0) | 2012.05.24 |
직렬화 간단 사용 예제 (0) | 2012.05.11 |
UIPopoverController 사용 예제 (0) | 2012.05.11 |