2016-10-06 44 views
1

此代碼用來工作,但ios的10後,停止運作:右對齊的UISearchBar佔位

UITextField *searchTextField = [_searchBar valueForKey:@"_searchField"]; 
searchTextField.textAlignment = NSTextAlignmentRight 

我曾經嘗試都段落和attributedPlaceholder,但佔位符始終是左對齊。該錯誤出現在xcode 7和8中。我該如何解決這個問題?

+0

請參閱此鏈接,http://stackoverflow.com/questions/11394489/is-is-possible-to-change-a-uisearchbar-placeholders-alignment。 – KAR

+0

它不工作... – tomeron11

回答

2

如果您需要進行這些類型的自定義,請不要使用UISearchBar。您必須使用UITextFieldUIImageView來製作您自己的電話,並對delegate電話進行響應。