2011-08-31 3 views
0

단추는 UIActionSheet를 만드는 함수를 트리거합니다. 다음과 같이 보입니다 :UIActionSheet에 넣을 때 UITextFiled를 입력 할 수 없습니다.

reportSheet = [[UIActionSheet alloc] 
       initWithTitle:nil 
       delegate:self 
       cancelButtonTitle:nil 
       destructiveButtonTitle:nil 
       otherButtonTitles:nil 
       ]; 

[reportSheet setActionSheetStyle:UIActionSheetStyleBlackTranslucent]; 

이 ActionSheet에 UITextField를 추가 할 때 어떤 것도 입력 할 수 없습니다. 키보드가 나타나지만 버튼을 누르면 아무 일도 일어나지 않습니다. 마커는 단지 위치 0에 서서 깜박입니다. I (위 대신 reportSheet의) self.view하는 텍스트 필드를 추가하는 경우

newComment = [[UITextField alloc] initWithFrame:CGRectMake(10, 10, 300, 200)]; 
newComment.backgroundColor = [UIColor redColor]; 
newComment.delegate = self; 
[reportSheet addSubview:newComment]; 
[newComment release]; 

그것을 잘 작동하고 거기에 입력 할 아무 문제가 없습니다 : 이 코드는 다음과 같습니다.

어떤 아이디어가 잘못 되었나요?

+0

당신은 모양 @ [UISwitch와의 UITextField 아이폰 UIActionSheet]을해야 할 수도 있습니다 (http://stackoverflow.com/questions/3654091/iphone-uiactionsheet-with-uiswitch-and-uitextfield) 및 [UIActionSheet있는 UITextField 텍스트 입력을 활성화하는 방법?] (http://stackoverflow.com/questions/5089437/how-to-enable-text-input-in-uitextfield-which-is-in-uiactionsheet) –

+0

'UITextField'의 프레임 크기에 문제가 있다고 생각합니다. – Legolas

답변

3

시도

[newComment.layer addAnimation:[reportSheet.layer animationForKey:reportSheet.layer.animationKeys.lastObject] forKey:reportSheet.layer.animationKeys.lastObject]; 
[[reportSheet superview] addSubview:newComment]; 
관련 문제