나는 나를 괴롭 히고있는 문제가 있습니다. iOS의 UI 작업 시트에서 CoreData에 제공된 배열에 정보를 저장해야합니다. 문제는 액션 시트가 데이터를 저장하는 데 사용 된 것과 다른 기능을 수행한다는 것입니다. 내가 만드는 것 같은CoreData의 배열에 UIActionSheet 데이터 저장
- (void)showSalutation:(id)sender
{
UIActionSheet *popUp = [[UIActionSheet alloc] initWithTitle:@"Choose Salutation" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Cancel" otherButtonTitles:@"Mr.", @"Mrs.", @"Ms.", @"Dr.", nil];
popUp.actionSheetStyle = UIActionSheetStyleBlackTranslucent;
[popUp showInView:self.view];
[popUp release];
}
- (void)showSalutation:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (buttonIndex == 0)
{
Salutation.text = @"Mr.";
}
else if (buttonIndex == 1)
{
Salutation.text = @"Mrs.";
}
else if (buttonIndex == 2)
{
Salutation.text = @"Ms.";
}
else if (buttonIndex == 3)
{
Salutation.text = @"Dr.";
}
}
느낌 :
첫째, 여기에 데이터를 저장하기위한 관련 코드입니다 :
(... checking for all fields; working properly)
}
else
{
newContact = [NSEntityDescription insertNewObjectForEntityForName:@"Contacts" inManagedObjectContext:context];
[newContact setValue:Salutation.text forKey:@"Salutation"];
[newContact setValue:FirstName.text forKey:@"FirstName"];
[newContact setValue:LastName.text forKey:@"LastName"];
[newContact setValue:CompanyName.text forKey:@"CompanyName"];
[newContact setValue:EmailAddress.text forKey:@"EmailAddress"];
[newContact setValue:PhoneNumber.text forKey:@"PhoneNumber"];
newContact.Disinfector =[NSNumber numberWithBool:yesWasher];
newContact.Sterilizer =[NSNumber numberWithBool:yesSterilizer];
newContact.CoffeeMaker =[NSNumber numberWithBool:yesCoffeeMaker];
Salutation.text = @"";
FirstName.text = @"";
LastName.text = @"";
CompanyName.text = @"";
EmailAddress.text = @"";
PhoneNumber.text = @"";
yesWasher = YES;
[WasherTog setImage:[UIImage imageNamed:@"checked.png"] forState:UIControlStateNormal];
yesSterilizer = YES;
[SterilizerTog setImage:[UIImage imageNamed:@"checked.png"] forState:UIControlStateNormal];
yesCoffeeMaker = YES;
[CoffeeMakerTog setImage:[UIImage imageNamed:@"checked.png"] forState:UIControlStateNormal];
둘째, 여기에 액션 시트의 코드이고 입력 처리 초보자 실수 많이 했으니 제발 용서해주세요. 나는 주말 내내 코딩하는 법을 배웠고 너희들은이 물건에 가장 친한 친구였다. 나는 넷에서이 특별한 이슈를 보지 못했다.
미리 도움 주셔서 감사합니다. 크리스