UITextField的自动更正会在iOS 4.3 sdk构建目标的模拟器上崩溃我的应用程序.使用iOS 4.2 sdk在设备和模拟器中正常工作.
有其他人遇到过这个问题吗?我正在考虑4.3 sdk的错误?
只要输入第二个字符.堆栈跟踪
#0 0x01c01000 in objc_assign_ivar ()
#1 0x03b7ec34 in -[AppleSpell init] ()
#2 0x007e7538 in -[UITextChecker _checker] ()
#3 0x007e8de9 in -[UITextChecker checkSpellingOfString:startingAt:language:wrap:correction:] ()
#4 0x0b335725 in TIInputManagerZephyr::lookup_spellcheck_candidates(KB::String const&) ()
#5 0x0b3353f3 in TIInputManagerZephyr::lookup_static_dynamic_candidates(KB::String const&, KB::String const&, KB::Vector<KB::FPoint> const&, bool) ()
#6 0x0b332b2b in TIInputManager::lookup() ()
#7 0x0b332e18 in TIInputManager::autocorrection() ()
#8 0x0b34a06b in -[TIKeyboardInputManagerZephyr autocorrection] ()
#9 0x005cfbe8 in -[UIKeyboardImpl generateCandidatesWithCompletions:] ()
#10 0x005cfc3b in -[UIKeyboardImpl generateCandidates] ()
#11 0x005dca23 in -[UIKeyboardImpl …
Run Code Online (Sandbox Code Playgroud) 在我的应用程序中我使用默认IOS搜索栏的搜索功能,如果我放置一些字符串进行搜索工作正常但在第一次搜索后我需要显示整个数据源(原始内容.)我的功能是如果搜索字符串是为空它将显示整个数据源.我的问题是如果我在默认搜索栏中将搜索字符串设为空,搜索按钮会自动进入隐藏状态.我需要启用搜索按钮,即使字符串是空的.请指导我解决此问题.
谢谢.
我添加了一个UISearchBar
到我的顶部PFQueryTableViewController
.我已将searchBar的颜色更改为我的应用程序的颜色,但在执行此操作时,它似乎也将其右侧的"取消"按钮的颜色更改为相同的颜色.理想情况下,我希望颜色为白色.
此图显示了当前的外观:
它看起来没有"取消"按钮,但它有与searchBar相同的颜色(你仍然可以按它等)
有没有办法让我将这个'取消按钮的颜色改为白色?我尝试的一切似乎没有任何区别.
代码我用来制作UISearchBar
这种颜色是:
UISearchBar.appearance().barTintColor = UIColor(hue: 359/360, saturation: 67/100, brightness: 71/100, alpha: 1)
UISearchBar.appearance().tintColor = UIColor(hue: 359/360, saturation: 67/100, brightness: 71/100, alpha: 1)
Run Code Online (Sandbox Code Playgroud)
在故事板中我设置了这些:
最后,为了在SearchBar中制作占位符和文本白色,我使用了:
for subView in self.filmSearchBar.subviews {
for subsubView in subView.subviews {
if let searchBarTextField = subsubView as? UITextField {
searchBarTextField.attributedPlaceholder = NSAttributedString(string: NSLocalizedString("Search Cinevu film reviews", comment: ""), attributes: [NSForegroundColorAttributeName: UIColor.whiteColor()])
searchBarTextField.textColor = UIColor.whiteColor()
}
}
}
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助!:)
我正在玩Swift来学习它,而且现在我无法从中获取文本 UISearchBar
现在我的代码看起来像这样:
import UIKit
class SecondViewController: UIViewController {
@IBOutlet var myWebView : UIWebView
@IBOutlet var adressbar: UISearchBar
override func viewDidLoad() {
super.viewDidLoad()
adressbar.showsScopeBar = true
var url = NSURL(string: "http://google.com")
var request = NSURLRequest(URL: url)
myWebView.scalesPageToFit = true
myWebView.loadRequest(request)
}
func searchBarSearchButtonClicked( searchBar: UISearchBar!) {
var url = NSURL(string: adressbar.text)
var request = NSURLRequest(URL: url)
myWebView.scalesPageToFit = true
myWebView.loadRequest(request)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
}
Run Code Online (Sandbox Code Playgroud) 我试图在我的Android应用程序中实现类似于最新的gmail应用程序(操作栏中的搜索图标)的搜索功能.
点击"搜索"图标后,操作栏将变为搜索字段,左侧带有后退按钮,右侧带有麦克风按钮.我想在我的应用程序中使用相同的组件.
这有什么图书馆或教程吗?
这是否有可能在非棒棒糖版本中支持这种类型的材料设计搜索.?
android uisearchbar android-layout android-search material-design
我有一个简单的UIViewController
和a UISearchBar
,当视图加载时我想让搜索栏立即成为第一个响应者,以便键盘显示,他们可以立即开始键入他们的查询.我尝试在viewWillAppear
下面这样做,没有任何运气:
- (void)viewWillAppear:(BOOL)animated
{
[productSearchBar becomeFirstResponder];
[super viewWillAppear:animated];
}
Run Code Online (Sandbox Code Playgroud)
难道还有其他的,我要打电话的地方becomeFirstResponder
在UISearchBar
或者我应该是别的完全调用的东西吗?
iphone objective-c uiviewcontroller uisearchbar first-responder
我已经实现了一个设置了搜索功能的UISearch栏,但是当我按下键盘上的"搜索"按钮时,没有任何反应.如何在按住"搜索"按钮的同时保持键盘隐藏,同时保持搜索栏中的文本不变(保持搜索结果存在)?
我在UINavigationBar上面添加UISearchBar并设置UIsearchbar showsCancelButton YES,在iOS6中正常工作但在iOS7中没有显示取消按钮.我使用下面的代码片段
UISearchBar *searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, 600, 44)];
searchBar.showsCancelButton = YES;
searchBar.translucent = NO;
[searchBar setTintColor:[UIColor redColor]];
searchBar.backgroundColor = [UIColor yellowColor];
[self.navigationController.navigationBar addSubview:searchBar];
Run Code Online (Sandbox Code Playgroud) 当我在a上设置搜索字段背景图像UIImage
时,选中更改时,搜索栏中放大镜和占位符文本之间的填充.
使用默认背景:
使用自定义背景:
这种变化是由以下两行引起的:
UIImage *colorImage = [UIImage imageWithColor:[UIColor grayColor] size:CGSizeMake(28, 28)];
[self setSearchFieldBackgroundImage:[colorImage imageWithRoundedCorners:5] forState:UIControlStateNormal];
Run Code Online (Sandbox Code Playgroud)
imageWithRoundedCorners:
是一种类别方法,它只是将图像绘制到CALayer
具有角半径的图像上,然后UIImage
从图形上下文创建一个.
为什么这样,我怎么能避免这个?我尝试传递一个显式可调整大小的图像,但这没有任何效果.
uisearchbar ×10
ios ×6
objective-c ×4
iphone ×3
swift ×2
android ×1
cocoa-touch ×1
ios4 ×1
ios7 ×1
spacing ×1
uikit ×1
uitextfield ×1