몇 시간 동안이 질문을 연구했지만 소리가 꽤 간단하지만 실행 가능한 솔루션을 찾지 못했습니다. 나는 삭제를 확인하기 위해 UIActionSheet를 사용하는 iPad 응용 프로그램을 가지고 있습니다. 글꼴 크기를 늘리기 위해 레이블을 추가하고 있습니다. 모든 것이 잘 보이고 작동합니다. 액션 시트가 보이는 동안 희미 해지고 배경을 잠그기위한 요구 사항이 있습니다. 흐리게 표시 할 수 있지만 배경을 잠그는 방법을 볼 수 없으므로 사용자가 작업 시트에서 선택을 취소해야합니다. UserInteractionEnabled 설정을 시도했지만 작동하지 않습니다. 어떤 아이디어?iPad에서 UIActionSheet를 사용할 때 배경을 어둡게하고 잠그십시오.
// dim the background
UIView *dimViewDelete = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 1024, 768)];
dimViewDelete.backgroundColor = [UIColor blackColor];
dimViewDelete.alpha = 0.3f;
dimViewDelete.tag = 2222;
[self.view addSubview:dimViewDelete];
if ([self.listArray count] > 0)
{
// create Action Sheet
UIActionSheet * action = [[UIActionSheet alloc]
initWithTitle:@" "
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:@"Delete"
otherButtonTitles:nil];
[action addButtonWithTitle:@"Cancel"];
[action setActionSheetStyle:UIActionSheetStyleBlackTranslucent];
[action showInView:self.view];
// change the font size of the title
CGRect oldFrame = [(UILabel*)[[action subviews] objectAtIndex:0] frame];
UILabel *addTitle = [[UILabel alloc] initWithFrame:oldFrame];
addTitle.font = [UIFont boldSystemFontOfSize:22];
addTitle.textAlignment = UITextAlignmentCenter;
addTitle.backgroundColor = [UIColor clearColor];
addTitle.textColor = [UIColor whiteColor];
addTitle.text = @"Are You Sure?";
[addTitle sizeToFit];
addTitle.frame = CGRectMake(oldFrame.origin.x, oldFrame.origin.y,
oldFrame.size.width, addTitle.frame.size.height);
[action addSubview:addTitle];
}
필요가 없습니다. 액션 시트의 팝 오버 바깥 쪽 아무 곳이나 치면 "취소"로 처리됩니다. 사실, 취소 버튼은 iPad의 작업 시트에 나타나지 않습니다. 어떤 이유로 든 두 번째 취소 버튼을 추가한다고 생각합니다. 액션 시트의 행동을 일관되게 유지하는 것이 가장 좋습니다. 흐리게 배경을 정말로 원하고 사용자가 버튼을 누르도록 강요한다면 대신 'UIAlertView'를 사용하십시오. 또한 액션 시트의 내부 구조를 해킹하고 있습니다. 그것은 나쁜 생각입니다. 깨지기 쉽고 언젠가는 깨질 가능성이 있습니다. – rmaddy
희망찬 생각, 그렇 겠지. 나는 다른 길로 가야 할 것 같은데. 동의 할 수 있도록 의견을 보내주십시오. - 신속한 답장을 보내 주셔서 감사합니다. – LittlePeculiar