2017-08-11 27 views
0

有沒有辦法設置包含inputAssistantItem元素的欄的backgroundColor? (包含圖像中的「下一步」按鈕的工具欄):textField的inputAssistantItem欄的樣式

enter image description here

此外,是否有可能增加一個UILabel(如標題)了吧?

+1

我建議你使用InputAccesoryView代替,這將允許你使用自定義視圖 –

+0

@MarcioRomeroPatrnogic我也在想它,但我真的只需要背景顏色,它會爲我節省一些編碼(是的,我知道我懶惰,但它是星期五) – Daniel

+0

在UITextInputAssistantItem接口提供的代碼does not幫助..不要懶惰不是很多代碼:D –

回答

0

我建議你使用inputAccessoryView,因爲它是一個UIView,你可以用它做幾乎所有你想要的東西。

我打開「UITextInput.h」文件,似乎沒有辦法實現你想要的東西,因爲對象不給你工具。

這是我發現

NS_CLASS_AVAILABLE_IOS(9_0) __TVOS_PROHIBITED __WATCHOS_PROHIBITED @interface UITextInputAssistantItem : NSObject 

/// Default is YES, controls if the user is allowed to hide the shortcuts bar. Does not influence the built in auto-hiding logic. 
@property (nonatomic, readwrite, assign) BOOL allowsHidingShortcuts; 
/// Contains UIBarButtonItemGroups that should be displayed in the leading position on the keyboard's assistant bar. 
@property (nonatomic, readwrite, copy) NSArray<UIBarButtonItemGroup *> *leadingBarButtonGroups; 
/// Contains UIBarButtonItemGroups that should be displayed in the trailing position on the keyboard's assistant bar. 
@property (nonatomic, readwrite, copy) NSArray<UIBarButtonItemGroup *> *trailingBarButtonGroups; 

@end 

BAD可能的解決方案,直到找到工具欄可以檢查您創建按鈕的上海華盈,然後試圖改變你想要的代碼。我誠實地建議你不要做這個