2010-12-31 3 views
0

Skype 앱의 로그인보기에서 볼 수있는 것을 어떻게 얻을 수 있습니까?UITableField에서 UITableField의 하위보기로

테이블 모양 UILabel 및 UITextField를 사용하여 내 모습을 하위보기로 봅니다. 나는 그런 것을 한 번도하지 않았으므로 어떻게 할 수 있는지 알고 싶습니다.

답변

0

이렇게 할 수 있습니다. 다음 코드를 확인하십시오.

- (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]; 

    UILabel *startDtLbl = [[UILabel alloc] initWithFrame:CGRectMake(10, 10, 80, 25)]; 
    startDtLbl.backgroundColor = [UIColor clearColor]; 
    startDtLbl.tag = 1; 
    [cell.contentView addSubview:startDtLbl]; 

    UITextField *passwordTF = [[UITextField alloc] initWithFrame:CGRectMake(100, 5, 200, 35)]; 
    passwordTF.tag = 2; 
    [cell.contentView addSubview:passwordTF]; 
    } 
    return cell; 
} 

위와 같은 필드를 추가 할 수 있습니다.

+0

나는 이미이 코드들을 시도했지만, 나에게 도움이되지 못했다. :(그냥 정보, 프로그래밍 방식으로 tableview를 만들고 있어요. –

+0

그 다음에 당신이 tableView에 내용을 가져올 위치를 말하지 않는다고 추측 할 것입니다. tableView.delegate = self와 같은 줄이 있습니까? tableView.datasource = self? 또한 UITableViewDelegate 및 UITableViewDatasource 프로토콜을 구현해야합니다. –

관련 문제