0

这是我的源代码

[search setFrame:CGRectMake(listView.frame.origin.x, listView.frame.origin.y + 2,215, 52)];
        [search setPlaceholder:@"Search"];

        search.barTintColor = [UIColor colorWithRed:230/255.0f green:230/255.0f blue:230/255.0f alpha:1.0f];;
        [search setTranslucent:NO];
        search.delegate = self;
        [[UITextField appearanceWhenContainedIn:[UISearchBar class], nil] setTextColor:[UIColor blackColor]];
        UITextField *txfSearchField = [search valueForKey:@"_searchField"];
        txfSearchField.backgroundColor = [UIColor whiteColor];

它适用于 Xcode 5.0 上的 iOS 5、6、7

将 xcode 更新到 5.1 后,我的 uisearchview 在 iOS 7 和 iOS 7.1 中不显示键盘,但在 iOS 6 及更早版本中,它可以工作。

我不知道解决方案。

你能给我一些解决方案吗?

谢谢

4

1 回答 1

1

我遇到过同样的问题。如果您正在使用情节提要,我认为这会对您有所帮助。下载此处给出的示例代码。

https://developer.apple.com/library/ios/samplecode/TableSearch/Introduction/Intro.html#//apple_ref/doc/uid/DTS40007848

于 2014-04-06T12:23:57.913 回答