【问题标题】:How to change Background Color and Placeholder position of UISearchBar如何更改 UISearchBar 的背景颜色和占位符位置
【发布时间】:2016-03-14 07:19:54
【问题描述】:

我正在尝试在情节提要上添加 UISearchBar,但我发现背景颜色、文本占位符没有太多选项。我可以不编程吗?

【问题讨论】:

标签: ios objective-c iphone ios9 uisearchbar


【解决方案1】:

是的,在属性检查器中,您可以找到所有属性并根据需要在搜索栏中进行更改

您可以为您的应用创建自定义UISearchBar

//Custom search bar code
    UISearchBar *search = [[UISearchBar alloc] init];
    search.frame = CGRectMake(0, 200, 300,45);
    search.delegate = self;
    search.showsBookmarkButton = NO;
    search.placeholder = @"Search/Select a Creative Service";
    search.barTintColor = [UIColor whiteColor];
    [self.view addSubview:search];

【讨论】:

  • abhinathan 检查一次 qusetion ,提问者问Can i do that without programming
  • 是的,在属性检查器中,您可以找到所有属性并根据需要在搜索栏中进行更改
猜你喜欢
  • 2012-08-03
  • 2015-06-05
  • 2017-03-14
  • 1970-01-01
  • 2014-11-02
  • 2012-07-16
  • 1970-01-01
  • 2019-10-09
  • 2012-04-12
相关资源
最近更新 更多