2011-03-04 7 views
1

UIActionSheet을 약간 사용자 정의하고 싶습니다. 이 이전 게시물 에서처럼 기존 2 버튼 위에 사용자 정의 UIButton/UIImageView를 추가하기 만하면 기본 버튼 위에 텍스트 대신 사용자 정의 단추/이미지가 추가됩니다. 나는이 게시물에서와 같이 작동하는지 확인하기 위해 간단한 UILabel을 추가하려고 시도했다 : UIActionSheet Customization. I 위의 코드를 사용할 경우기본 단추가있는 ActionSheet에 사용자 지정 컨트롤을 추가하는 방법은 무엇입니까?

UIActionSheet *actionSheet = [[UIActionSheet alloc] 
        initWithTitle: @"" 
          delegate: self  
       cancelButtonTitle: NSLocalizedString(@"Cancel",@"cancel button") 
      destructiveButtonTitle: nil 
       otherButtonTitles: @"Send",nil]; 

actionSheet.tag = kCallActionSheetTag; 

UILabel *btn = [[UILabel alloc] initWithFrame: 
         CGRectMake(18, 10, 140, 50)]; 
accountLabel.textAlignment = UITextAlignmentLeft; 
accountLabel.textColor = [UIColor whiteColor]; 
accountLabel.text = @"Account"; 
accountLabel.font = [UIFont boldSystemFontOfSize:16]; 
accountLabel.backgroundColor = [UIColor clearColor]; 
[actionSheet addSubview:accountLabel]; 
[accountLabel release]; 
[actionSheet showInView:self.tabBarController.view]; 
[actionSheet setBounds:CGRectMake(0,0,320, 260)]; 
[actionSheet release]; 

두 버튼이 수직 상향으로 변위되어 UILabel 상단 버튼 중첩. 그들은 행동 시트의 맨 위에 고정되어있는 것처럼 보입니다. 차라리 내 단추를 추가하고 위치를 지정하지 않을 것입니다. 이 작업을 수행하는 가장 좋은 방법은 무엇입니까?

내 경험 UIAlertView에서입니다

감사

여기

답변

0

내 제안이는 내가 테스트하지 않았습니다.

상단 메시지를 오프셋 y 오프셋으로 크게 설정해야합니다.

다음 UILabel을 추가하십시오.

관련 문제