2012-02-04 1 views
0

다른 색상의 기본 파란색을 변경해야하기 때문에 iPad 앱의 UIActionSheet에서 강조 표시된 색상을 변경합니다 ... 나는 문서화되지 않은 함수를 사용하는 것이고, 아마도 이것이 유일한 방법 일 것입니다! 하지만 나는 앱 스토어에 갈 수없는 솔루션을 사용하지 않을 것이다 ...UIActionSheet - iPad의 강조 표시된 색상을 변경하는 방법 - iPad

어떤 아이디어 나 github 프로젝트가 링크를 사용합니까?

답변

2

내가 이런 식으로 해결 :

- (void)willPresentActionSheet:(UIActionSheet *)actionSheet { 

    //Gets an array af all of the subviews of our actionSheet 
    NSArray *subviews = [actionSheet subviews]; 

    for (UIView *v in subviews) { 
     if ([v isKindOfClass:[UIButton class]]) { 
      UIButton *b = (UIButton*)v; 
      [b setBackgroundImage:[UIImage imageNamed:@"backActionSheetHighlighted.png"] forState:UIControlStateHighlighted]; 
      [b setBackgroundImage:[UIImage imageNamed:@"backActionSheet.png"] forState:UIControlStateNormal]; 
     } 
    } 
} 

결과는 다음과 같다

enter image description here

1

링크를 따라 가면 액션 시트 http://www.ifans.com/forums/showthread.php?t=301851에 하위 뷰를 추가하는 방법을 알 수 있습니다. 그런 다음 버튼을 당신이 시도 할 수 있습니다 :

[myButton setBackgroundImageByColor:[UIColor greenColor] forState:UIControlStateHighlighted ]; 
+0

이 어떻게의 버튼에 액세스 할 수 있습니다 UIActionSheet? – Fry

+0

편집을 찾으십시오 .. –

+0

메서드'setBackgroundImageByColor :'존재하지 않습니다 ... – Fry