在iOS7中,搜索图标和占位符文本始终出现在中间。我尝试将搜索栏中文本字段的文本对齐方式更改为左对齐,但没有作用。
有没有办法让搜索栏的搜索图标在iOS7中左对齐显示?
我尝试了以下几行代码,但它们没有起作用:
我尝试了以下几行代码,但它们没有起作用:
UITextField *txfSearchField = [_searchBar valueForKey:@"_searchField"];
txfSearchField.textAlignment = NSTextAlignmentLeft;
[_searchArticle setImage:image forSearchBarIcon:UISearchBarIconSearch state:UIControlStateNormal];
UIimageView *im = [UIImageView alloc]init];
im.image = image;
txfSearchField.leftView =im;
sizeWithFont: constrainedToSize: lineBreakMode:
。 - kmithi1