2017-12-13 9 views
0

UITableview 셀을 사용하여 일련의 질문 목록을 표시하고 2 개의 텍스트 필드는 점수 1이고 점수 2는 점수를 입력 한 후 스크롤하면 전체에 레이블이 표시됩니다 inputed 데이터가 jQuery과 K2661에 하나 사라되는 시간은 내가이 문제를 해결하고보기에이 텍스트 필드와 라벨을 추가하고 도움을 주시기 바랍니다이보기UITableview 셀 스크롤 시간 텍스트 필드 업데이트 후 데이터 필드 데이터가 사라짐

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
static NSString *CellIdentifier = @"CellIdentifier"; 

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 
if (cell == nil) { 
    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; 
} 
else{ 
    for (UIView* view in cell.contentView.subviews) { 
     if ([view isKindOfClass:[UIView class]]) { 
      [view removeFromSuperview]; 
     } 
    } 
} 

텍스트 필드로 추가 cell.contentview의 하위 뷰

UIView * vwbackground = [[UIView alloc] init]; 
[vwbackground setFrame: CGRectMake(5.0, 5.0, [UIScreen mainScreen].bounds.size.width-10, 90)]; 
vwbackground.backgroundColor = [UIColor whiteColor]; 
[cell.contentView addSubview:vwbackground]; 

self.txtfldInPut1.clearButtonMode = UITextFieldViewModeWhileEditing; 
self.txtfldInPut1.autocorrectionType = UITextAutocorrectionTypeNo; 
self.txtfldInPut1.inputAccessoryView = numberToolbar; 
[vwbackground addSubview:self.txtfldInPut1]; 

답변

0

이것은입니다. 테이블 셀의 데이터는 스크롤 할 때 목록 항목마다 계속 변경되기 때문입니다. 이것은 테이블 뷰에있는 셀의 기능입니다. 당신이해야 할 일은 당신의 점수를 입력 할 때 목록에 데이터를 집중적으로 보여주고있는 배열/이명 (당신이 취한 것)에 그 값을 업데이트하는 것입니다.

+0

암은 하나의 문자열로 데이터를 복용 :) 도움이하고있는 주요 데이터 API를 예에서 오는되는 데이터를 시간도 데이터는 단지 설명을위한 –

+0

을 사라지고을 넣어 다시로드하면 내가 하나 부울을 설정 희망 제이슨 형식 –

+0

예 api에서 오는 주요 데이터와 사용자 점수 1과 2를 추가하고 합계도 사라진 후 스크롤 표시 –