I am programming with Swift for iOS 8.
I would like to have a SearchBar on top of a Table that looks like and behave exactly like the one in Contacts App in the iPhone.
So far I have a UIViewControl embedded in a NavigationController, added an UISearchBar and an UITabelView to the UIViewControl. The Table is populated with data and searching is working. Problem: when I dismiss the keyboard, the Cancel Button is greyed out.
When I add the SearchBar with code and put it in self.tableView.tableHeaderView,
Keyboard and Cancel buttons works as expected but the SearchBar stays not in place when scrolling the tableView.
None of the many tutorials and advices I found solved the problem.
Any advices or tips?
Related
For some reason, the lower bar button items, Select All and Select None shown in the image from storyboard below are not displaying. I copied this configuration from another app where it works fine. Can't for the life of me figure out what could be the problem. The upper buttons, Cancel and Done do display. This VC is presented modally.
Has anyone seen this before or can you suggest what could be wrong?
The bar buttons are not outlets. They are wired to action methods, however, since they do not display in the app, I can't tell if they work.
The other thing that is not working properly here is that the tableview is empty. However, for now I'd be content to see the lower bar button items. I've tried changing the table view size to no avail.
Thanks in advance for any suggestions
storyboard:
What displays on phone:
I have two UITextFields inside a static TableView (in a Storyboard) for loggin in. The first time go to the tableView via a modal segue, the TextFields are editable as they should be. When I then go back and forth to that view again, the TextField seem to be non-editable. If I read out the textField.isEnabled, it is set to YES.
Even more strange: this behavior is only with iOS 6.0. On iOS 5.0 everything is fine.
I've already added this in viewWillAppear
TextField.userInteractionEnabled = YES;
I've also commented out all of my viewDidLoad and viewWillAppearCode, but still no avail.
Any idea is welcome.
EDIT: after closing and restarting the app, I once again have one shot. I looks like something is screwed, once I opened and closed the view.
I actually had a very similar problem with my TextFields in one view not being editable after doing a back and forth segue with another view. For me, it was a problem with the first responder status, and things started working fine after adding the following in prepareForSegue:
[self.textFieldName1 resignFirstResponder];
Hope that helps.
This is simple one though:
I'm having XCode 4.2 with iOS beta7. I am just trying a to have to views with one button in first view. On click of button, it will show next view.
In many tutorials, when I click and drag the button to next view, it will show "performSegueWithIdentifier:sender:" view.
But in my interface builder, its showing "Storyboard Segues with Push, Modal, Popover, Custom......"
I don't know whether I'm doing wrong or its the behavior of the xcode itself....
can some one suggest me good tutorials for iOS5 storyboard please?
Yes, you doing everything right. Push, Modal are types of showing next screen (UIView). You need to select it according Human Interface Guidelines from Apple.
I've a view controller (named it as SearchViewController) with UITableView and UISearchBar. UISearchBar is set to table as a header view. While searching in the table using this searchbar works great.
By selecting any one of the displayed search results, I can move to next view (named it as DetailsViewController). But after returning to the SearchViewController, magically the UISearchBar is disappeared and my app is crashed. I found the same code is working fine on iOS 3.1.2 but not on iOS 4.0 (no idea about 4.0.1 or 4.0.2).
I'll be really thankful, if anyone has a work around for this.
I always use an UINavigationBar and an UINavigationItem to display the UISearchBar. Setting the navigationItem.titleView to the searchBar works fine for me. (Don't forget to call [theSearchBar sizeToFit])
Please give us more information on the crash. What is the console output?
I have seen this question posted several times with no useful answers. I am trying to place a toolbar above my UIKeyboard in my iPhone app, but am having difficulty. I found this example which works GREAT, except that my view is a UITableView instead of the standard [self.view addsubview:...]. Can anyone figure out how to apply this to a UITableView?
In short, I have several UITextFields in my table cells, so I want the toolbar to appear above the keyboard for those cells.
Many thanks,
Brett
Just don't use the table view directly as a view.
Use a view that will have a table view inside it.
This way you will be able to use the tutorial as is...
In my opinion this way is much better - I don't have view controller with a single table view in any of my applications. There is always something additional on the screen...
In addition, I don't think that using parentViewController is good solution.
Not always you have one.
Actually, I don't even understand how it works for you...
A work around for this would be to create a hidden textfield in a viewcontroller and present it modally with it begin the first responder. The view can be completely transparent and the toolbar can be configured using the interface builder.