가 여기에 내가 현재 가지고있는 프로세스의 :하나의 모달 뷰 컨트롤러에서 새 테이블 셀 데이터를 추가하려면 어떻게합니까?
1) 탭은 데이터가있는 UITableViewCell에 추가)) 버튼 이 추가 내 모달 뷰 컨트롤러 3) 저장을 눌러 버튼 4 UITextFields를 기입 5)를 반복 한 단계 - 3 6) 새 데이터가 두 번째 셀에 추가되지만 두 셀의 데이터가 새 입력의 데이터입니다.
동일한 모달 뷰 컨트롤러를 사용하여 새 데이터를 추가 할 수 있지만 이전 셀) 그리고 심지어 그 세포 (들)을 두 드릴 때 데이터를 볼 수 있습니까?
-(IBAction)saveData
{
if (_majorTextField.text == nil)
{
_majorString = @"";
}
else
{
_majorString = [[NSString alloc] initWithFormat:@"%@", _majorTextField.text];
[_majorTextField setText:_majorString];
NSUserDefaults * majorDefault = [NSUserDefaults standardUserDefaults];
[majorDefault setObject:_majorString forKey:@"major"];
}
// Other text field code here
[self dismissViewControllerAnimated:YES completion:nil];
}
모든 : 내 모달 뷰 컨트롤러의 텍스트를 저장하고 위치를
다음-(IBAction)goToModalView:(id)sender
{
if (self.educationViewController == nil)
{
EducationViewController * temp = [[EducationViewController alloc] initWithNibName:@"EducationViewController" bundle:[NSBundle mainBundle]];
self.educationViewController = temp;
_dataArray = [[NSMutableArray alloc] init];
[_dataArray addObject:temp];
}
else
{
[self addEducation:sender];
}
[self presentViewController:self.educationViewController animated:YES completion:nil];
}
-(IBAction)addEducation:(id)sender
{
[_myTableView beginUpdates];
[_dataArray addObject:self.educationViewController.majorString];
NSArray * paths = [NSArray arrayWithObject:[NSIndexPath indexPathForRow:[_dataArray count]-1 inSection:0]];
[_myTableView insertRowsAtIndexPaths:paths withRowAnimation:UITableViewRowAnimationTop];
[_myTableView endUpdates];
}
은 다음과 같습니다
는 모달 뷰 컨트롤러로 가서 거기에 데이터를 추가하는 내 과정이다 조언을 부탁드립니다! 감사합니다.
_dataArray는 내가 추가 할 NSMutableArray입니다. 그냥 물건들을 분리시키는 법을 알아낼 수 없습니다. –
죄송합니다. 처음에는 그 사실을 알지 못했습니다. EducationViewController를 볼 수 있습니까? –
구체적으로 어떤 부분이 있습니까? –