여기에 나는이 텍스트 필드의 모든 속성을 생성하고 새로 만든 필드에 할당하고사용자 지정 UITableViewCells UITextField 강하거나 약한 참조? 나는 실용적 등 uitextfields, uisegmentedcontrols와의 tableview,</p> <p>을 설정하고있어
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
//NSLog(@"creating a new %@", CellIdentifier);
if([CellIdentifier isEqualToString:@"ID"]) {
UITextField *newTextField = [[UITextField alloc] initWithFrame:CGRectMake(80, 5, 215, 34)];
self.idField = newTextField;
[cell addSubview:self.idField];
}
}
예를의 너는 볼 수있어.
제 질문은 (비 원자력, 강함) 또는 (비 원자력, 약함)을 사용해야합니까?
@property(nonatomic, weak) UITextField *idField;
//Or
@property(nonatomic, strong) UITextField *idField;
idField는 한 번에 하나의 텍스트 필드 일 수 있습니다. 가장 최근에 만든 텍스트 필드에 속성의 참조를 저장하려고합니까? 궁극적으로 무엇을 성취하려고합니까? 작성한 모든 텍스트 필드에 대한 참조를 유지하려는 의도가있는 경우이를 수행하지 않습니다. – geraldWilliam
idField, upcField, Alias 필드, Description 필드 등이 있습니다. 텍스트 필드를 읽을 수 있도록이 작업을 수행했습니다. 즉 [self.idField.text] 현재와 같이 정상적으로 작동합니다. 난 그냥 강한 또는 약한 사용해야하는지 궁금 하군요 – Hackmodford