2010-03-03 7 views

답변

5
  1. 새 파일 - 인터페이스에 대한 XIB (모두 확인)
  2. 열린 XIB 파일
  3. 변화 뷰 스타일 (코코아 터치 클래스> UIViewController 하위) 있는 UITableViewController 하위 클래스 (plain-> 속성 검사기에 그룹) (사과 키 + 1)하는 .m 파일에
  4. 추가 다음 코드
 
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 
    return 1; 
} 
 
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 
    return 2; 
} 
 
- (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.selectionStyle = UITableViewCellSelectionStyleNone; 
    } 

    if(indexPath.row == 0) { 
     cell.textLabel.text = @"Username"; 
     UITextField *field = [[[UITextField alloc] initWithFrame: CGRectMake(120, 10, 180, 30)] autorelease]; 
     [cell addSubview:field]; 

    } 
    else if(indexPath.row == 1) { 
     cell.textLabel.text = @"Password"; 
     UITextField *field = [[[UITextField alloc] initWithFrame: CGRectMake(120, 10, 180, 30)] autorelease]; 
     field.secureTextEntry = YES; 
     [cell addSubview:field]; 
    } 

    return cell; 
} 
 
- (NSString *)tableView: (UITableView *)tableView 
titleForHeaderInSection: (NSInteger)section 
{ 
    return @"Account"; 
} 
 
- (NSString *)tableView: (UITableView *)tableView 
titleForFooterInSection: (NSInteger)section 
{ 
    return @"If you don't have a twitter account, go to twitter.com to sign up."; 
} 
+0

놀라운! 고맙습니다! –

관련 문제