uisearchbar

UITableView content overlaps Status Bar when UISearchBar is active

喜欢而已 提交于 2019-12-03 10:35:23
问题 I have a UITableViewController with a UISearchBar and UISearchDisplayController. That exists inside a Container View in a UIViewController which is in a UINavigationController. I made this image to help describe the structure: This is what it really looks like: When I tap the Search Bar, I have to hide the Nav Bar. Normally, this would happen on its own, but since my UITableViewController is inside a Container View, I have to handle that change myself. This is what it looks like then, note

becomeFirstResponder works in viewDidAppear but doesn't work in viewDidLoad

十年热恋 提交于 2019-12-03 10:28:13
My Application has a modal view controller, including a search bar. When the view comes up, I want the search bar to be focused. I tried [self.searchBar becomeFirstResponder] in viewDidLoad , but it didn't work. Later on I put it in viewDidAppear , it worked. But with this workaround, there is a visible delay. (after the view fully appeared, the keyboard began to appear) I can ensure both viewDidAppear and viewDidLoad have been invoked. What should I do if I want the search bar to be focused instantly with the view appear? (I'm using StoryBoard) Followed the answers, I tried to put the code in

How do you hide/show UISearchBar's scope bar with animation?

两盒软妹~` 提交于 2019-12-03 10:12:56
I want to show no scope bar when the table is empty (before the search bar edits for the first time), no scope bar when it's editing, and finally show it when editing done. I know about the UISearchBarDelegate protocol, but I don't know how to show/hide the scope bar with animation. I know UISearchBar has setShowsScopeBar: , but no setShowsScopeBar:animated: the way it does for setShowsCancelButton:animated . Edit It's important that to call [searchBar sizeToFit] after showing/hiding the scope bar. Is there a good way to animate this? (Should I do this ? It doesn't appear to work.) Here's how

Designing iOS SearchBar

怎甘沉沦 提交于 2019-12-03 09:23:06
问题 I want to have a simple SearchBar in ObjectiveC. Using UISearchBar or UISearchBarDelegate is confusing me. I could have used a UITextField but it does not have the look & feel of a search bar. As in the image attached, I want just the searchbar no UITableView associated with it. The image has a TableView attached but you get the point. Also after someone enters text into the searchBar & pressed "enter" how do I retrieve the text? UPDATE: I am aware of these links which discuss the same, but

Cancel out of UISearchBar when user taps on view

与世无争的帅哥 提交于 2019-12-03 09:03:59
Does anyone know how to cancel (resign First Responder) out of a UISearchBar when you tap below the search text box and above the keyboard? Can anyone help post some code to handle this? Thanks An alternative idea I got from iphonedevbook , sample code project 04, was to use one big transparent button that lies behind all other controls which does nothing but resign all first responders if tapped. I.e. if the user taps anywhere where there isn't a more important control - which is the intuitive behavior - the search bar and keyboard disappear. Add a tap gesture in the parent view (of the

How to show a UISearchBar from top of screen for table view controller

你。 提交于 2019-12-03 08:58:35
I'm looking to duplicate how the Facebook Messenger app shows the UISearchBar. When you tap the leftBarButtonItem in the navigationBar, the UISearchBar appears/animates from the top of the screen down, and when you cancel, it simply disappears upwards where it originated from. I used to have my UISearchBar as the default setup in my table view's header (in storyboard), but now I'm wanting to do what I stated above but I am not sure where to begin. My search displayer controller is still in my storyboard, but I have deleted the searchBar from the tableView controller in the storyboard. I

How to iBooks like search UI on table

蓝咒 提交于 2019-12-03 08:51:57
I want to show the search bar of tableview like that in iBooks. How can i reduce the width of searchbar and how it can be shown without any background color. Also how can i hide the search box initially when the page is displayed. I can think of two options: Create your own by subclassing UITextfield set border style to UITextBorderStyleNone set the leftView to a magnifying glass image set the background to a transparent png with only the round border showing make use if the uiimages stretchableImageWithLeftCapWidth:topCapHeight method so the background image will looks nice when stretched

How to search for locations using UISearchBar with autocompletion and suggestions?

与世无争的帅哥 提交于 2019-12-03 08:51:26
问题 I am developing an app in which user can search for a point of interests, pick a search result and then the MKMapView will be centered to the result coordinate. My question is how to make autocompletion happen? I have did research on MKLocalSearch and MKLocalSearchRequest , and it seems that is Apple suggested API for location search on iOS6.1+. However I cannot find any examples with autocompletion or suggestions with MKLocalSearch and MKLocalSearchRequest . Is it possible to autocomplete a

UISearchBar Scope Bar Position?

匿名 (未验证) 提交于 2019-12-03 08:50:26
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am here on an iPad Application and i would like to know if its possible to move the Scope Bar from right to my UISearchBar to another position? I would like to have my Scope Bar under my Search Bar. Is that possible? Thanks in advance. 回答1: Ok this is my solution for that. Ill implemented my own segmented control to create a possibility for a search scope. let categories = ["Scope1", "Scope2", "Scope3"] segmentedControl.addTarget(self, action: "changeScope:", forControlEvents: .ValueChanged) segmentedControl.frame = CGRectMake(8, 5, 800,

iOS 7 doesn't show cancel button of search bar in navigation bar

半腔热情 提交于 2019-12-03 08:37:47
问题 In an app that's supposed to run on iOS 6 and iOS 7, the cancel button of the search bar embedded in the navigation bar is not shown anymore if the app is run on iOS 7. On iOS 6, it works. The search bar is in the title view of the navigation bar and the cancel button should be shown if the search bar becomes the first responder: iOS 7 iOS 6 In an isolated test case, the code is very simple: @interface MyViewController : UITableViewController<UISearchBarDelegate> @property (nonatomic)