경고를 표시하는 alertview가 있습니다. 내 헤더에는 UIAlertViewDelegate가 포함되어 있지만 경고보기의 단추를 클릭 할 때마다 응용 프로그램이 인식되지 않는 선택기가 전송되었다고 말하는 과도한 초과로 인해 충돌이 발생합니다.UIAlertView 단추 누르기로 인해 다른 모든 항목이 정상적으로 작동 할 때 충돌이 발생합니다.
어떤 아이디어라도 도움이 될 것입니다. 나는 전혀 문제가없는 다른 클래스에서 똑같은 코드를 실행하고있다. 여기
내 코드입니다 :-(void)deletePatient
{
NSLog(@"Delete");
//Patient *patientInRow = (Patient *)[[self fetchedResultsController] objectAtIndexPath:cellAtIndexPath];
NSMutableArray *visitsArray = [[NSMutableArray alloc] initWithArray:[patient.patientsVisits allObjects]];
//cellAtIndexPath = indexPath;
int visitsCount = [visitsArray count];
NSLog(@"Visit count is %i", visitsCount);
if (visitsCount !=0)
{
//Display AlertView
NSString *alertString = [NSString stringWithFormat:@"Would you like to delete %@'s data and all their visits and notes?", patient.nameGiven];
UIAlertView *alert1 = [[UIAlertView alloc] initWithTitle:alertString message:nil delegate:self cancelButtonTitle:@"Yes" otherButtonTitles:@"No",nil];
[alert1 show];
[alert1 release];
}
else if (visitsCount ==0)
{
//Do something else
}
[visitsArray release];
}
-(void)alertView:(UIAlertView*)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
// the user clicked one of the OK/Cancel buttons
if (buttonIndex == 0)
{
NSLog(@"Yes");
}
else
{
NSLog(@"No");
}
}
그래서 난 그것을 알아낼 수있는 최선의, 사실 내가있는 UITableViewCell 서브 클래스에서 deletePatient 메소드를 호출하고, 내가 할로 환자 개체를 따라 전달하고 있습니다에 관련 그래서. 전달할 코드는 다음과 같습니다.
-(IBAction)deletePatient:(id)sender
{
NSLog(@"Delete Patient:%@",patient.nameGiven);
PatientListTableViewController *patientList = [[PatientListTableViewController alloc] init];
patientList.patient = patient;
UITableView *tableView = (UITableView *)[self superview];
tableView.scrollEnabled = YES;
[patientList deletePatient];
menuView.center = CGPointMake(160,menuView.center.y);
[patientList release];
}
인식 할 수없는 선택기 서명이란 무엇입니까? – executor21
콘솔에 표시되는 오류는 다음과 같습니다. - [NSCFType alertView : clickedButtonAtIndex :] : 인식 할 수없는 선택기가 인스턴스 0x1766400에 전송되었습니다. – monotreme