2017-01-29 2 views
0
ActionSheetStringPicker.show(withTitle: "Select Status", rows: pickerData, initialSelection: self.selectedStatusRow, doneBlock: { 
         picker, value, index in     
         self.selectedStatusRow = value          
         return 
        }, cancel: { ActionStringCancelBlock in return }, origin: sender) 

내가 원하는 것은이 라이브러리를 사용하는 동안 신속한 취소 및 취소 버튼의 색상을 변경하는 것입니다. 어떻게 수행 할 수 있습니까? 나는 내 주제를 취할 필요, 글로벌 색조 색상은 내가 Github에서 페이지의 예제 프로젝트에서 당신에게ActionSheetStringPicker 변경 버튼 색상

+0

의 기본 취소 사용자 정의하는 샘플 코드 및 완료 도구 모음 버튼입니다 지역화 몇 가지 예를 들어 검색했다 기본 라이브러리로 변경하십시오. 그렇지 않으면 해당 옵션이 없습니다. –

답변

0

당신이 사용할 수있는 작업 해결하는 것입니다 다음과 같이 SWActionSheet.m 파일에서 작업 선택기를 호스팅하는 메인 창에 색조 색상을 설정 :

- (UIWindow *)window { 

    if (SWActionSheetWindow) 
    { 
     return SWActionSheetWindow; 
    } 
    else 
    { 
     return SWActionSheetWindow = ({ 
      UIWindow *window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 
      window.windowLevel  = UIWindowLevelAlert; 
      window.backgroundColor = [UIColor clearColor]; 

      // Window Tint Color. 
      [window setTintColor:[UIColor whatEverColor]]; 

      window.rootViewController = [SWActionSheetVC new]; 
      window; 
     }); 
    } 
} 

PS합니다. 이것은 프로젝트의 actionsheetpicker의 모든 단일 인스턴스에서 기본 버튼의 색조 색을 설정합니다.

출처 : https://github.com/skywinder/ActionSheetPicker-3.0/issues/54

0

내가 기본 취소하고 완료 버튼, 여기에이 ActionSheetPicker 3.0

@IBAction func showCompanyTypes(_ sender: Any) { 

    let cancelButton:UIButton = UIButton(type: .custom) 
    cancelButton.setTitle("Cancel", for: .normal) 
    cancelButton.setTitleColor(UIColor.black, for: .normal) 
    cancelButton.frame = CGRect(x: 0, y: 0, width: 55, height: 32) 

    let doneButton:UIButton = UIButton(type: .custom) 
    doneButton.setTitle("Done", for: .normal) 
    doneButton.setTitleColor(UIColor.black, for: .normal) 
    doneButton.frame = CGRect(x: 0, y: 0, width: 55, height: 32) 

    let acp = ActionSheetStringPicker(title: "Company Type", rows: ["Private Sector", "Government", "Semi Government", "Free Zone"], initialSelection: 0, doneBlock: { 
     picker, values, indexes in 

     print("values = \(values)") 
     print("indexes = \(indexes)") 
     print("picker = \(picker)") 

     return 

    }, cancel: { ActionMultipleStringCancelBlock in return }, origin: sender) 


    acp?.pickerTextAttributes = [NSFontAttributeName: UIFont.systemFont(ofSize: 15.0)] 
    acp?.setTextColor(UIColor.black) 
    acp?.pickerBackgroundColor = UIColor.white 
    acp?.toolbarBackgroundColor = UIColor.white 
    acp?.toolbarButtonsColor = UIColor.black 
    acp?.setCancelButton(UIBarButtonItem(customView: cancelButton)) 
    acp?.setDoneButton(UIBarButtonItem(customView: doneButton)) 
    acp?.show() 

}