나는 텍스트 필드와 레이블이 포함 된 tableview가있는 응용 프로그램에서 작업하고 있습니다. 이제 내가 원하는 것은 점수를 가진 텍스트 필드에 텍스트를 입력 할 때 무언가를 계산하고 그 셀에 대한 tableview 레이블의 결과 백분율을 알려주는 것입니다. cellForRowAtIndexpath에 tetfield와 label을 어떻게 만들었는가? Textview에서 Tableview의 Label으로 값 가져 오기
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
lblpercent = [[UILabel alloc]initWithFrame:CGRectMake(395, 5, 270, 30)];
UITextField *txtscore = [[UITextField alloc] initWithFrame: CGRectMake(306,5,100,30)];
txtscore.delegate = self;
txtscore.keyboardType = UIKeyboardTypeNumberPad;
[txtscore addTarget:self action:@selector(textFieldDone:) forControlEvents:UIControlEventEditingDidEnd];
lblpercent.text = per;
}
그리고 난 방법에서이 문제를 해결 할 수있는 다음 코드
-(void) textFieldDone: (id) sender
{
UITextField *field = sender;
NSLog(@"%d",i);
NSString *total = field.text;
int tot = [total intValue];
NSLog(@"The text is %d", tot);
per = [[NSString alloc] init];
if (tot == 90) {
percent=90;
}
per = [NSString stringWithFormat:@"%d",percent];
}
을 사용 caqlculation에 대한
?
뭘 풀어? 우리는 문제를 해결하기 전에 먼저 문제가 필요합니다 ... –