2009-09-14 3 views
1

iPhone 응용 프로그램 (화면 하단의 팝업)에서 표준 팝업 동작을 사용하고 있습니다. 여기에는 2 개의 버튼 "ok"와 "cancel"이 있습니다. 기본 색상은 빨간색으로 가기 버튼이있는 것 같습니다. 상단 버튼이 초록색이되도록 변경하고 싶습니다. 나는 영원히 인터넷 검색을 해왔고 해결책을 찾을 수 없다. 어떤 아이디어라도 좋을 것입니다.표준 팝업 동작에서 버튼 색상 변경

NSArray* subViews = [aSheet subviews]; 
for (UIView* sView in subViews) 
{ 
    ... 
} 

을 그리고 당신이 원하는대로가 파단 속성을 변경 : 그런 - 감사

당신은 ActionSheet 탐색 할 수

답변

1

는 파단 (난 당신이 UIActionSheet 클래스를 사용하는 가정).

UIActionSheet* aSheet = [[UIActionSheet alloc] initWithTitle:@"\n\n\n" delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil]; 

을 그리고 이후에 사용자 정의 버튼을 생성하고이 ActionSheet보기에 추가 :

또한 전혀 버튼없이 UIActionSheet를 만들 수 있습니다. (시트 높이를 늘리려면 \ n을 더 붙이십시오)

1

나는 당신이 UIActionSheet를 언급하고 있다고 가정합니다. UIActionSheet에서 동작을 취소하고 검정색 배경, 파괴 동작을 표시하고 빨간색 배경 및 흰색 배경을 가진 다른 모든 단추가있는 단추를 정의 할 수 있습니다. – initWithTitle:delegate:cancelButtonTitle:destructiveButtonTitle:otherButtonTitles:을 사용하여 UIActionSheet의 초기화에서 지정할 수있는 작업 클래스에 해당하는 옵션입니다.

단추에 이러한 색만 사용해야하는 이유를 포함하여 UIActionSheet의 디자인은 iPhone Human Interface Guidelines에 설명되어 있습니다. 이 점에서 Apple의 제안을 따르기를 바랍니다. 귀하의 응용 프로그램을보다 쉽게 ​​사용하게 만들 것입니다.

1
UIActionSheet *action = [[UIActionSheet alloc] initWithTitle:@"" 
          delegate:self 
          cancelButtonTitle:@"Cancel" 
          destructiveButtonTitle:nil,@"Mail",@"Facebook",@"Twitter",nil 
          otherButtonTitles:nil]; 
NSArray *buttons = [action subviews];