How do i make a picker show up when a user selects a text field - ios

I am new to swift and have trouble making drop down lists.
I have a story board that needs to contain about 6 questions the user needs to fill in and so far all i have working is picker views and i can only fit 2 or 3 on the screen.
What is the best way to to create a drop down lists in Swift?

For implementing drop down you can use the table view,set its hidden property YES and when user clicks on the text field change hidden property to NO.This is the easiest way to implement drop down using table view in ios.

Related

How to design a add new entry screen like in the Health app?

I'm creating my first app and I wanted to design an "add a new item" modal like in the health app:
Here I have three questions:
How the 3 input fields are designed that you see the hint all the time on the left and the imput on the right? Is this just one field?
Are this 3 fields usually stored in a tableView?
Is the entry for the Date a special keyboard type or a DatePicker?
That looks like a UITableView with a custom cell which has a UILabel on the left and an input field on the right. The picker is a UIDatePicker

iOS Swift how to show dynamic ui based on selction from drop list

Heloo all,
I am new to ios swift. I have one problem in my screen.
I have one screen with drop down list of option like : current bill,water bill., bike bill, loan bill, phone bill....so on
I have sone this. But what i need is, whenever i select any option from drop down list. I need to show some ui elements like label, text filed, text box, lie that dynamically for each each selction in drop list.
For example :
if i select water bill, then below my drop down, i need to show the two label ui with name , id.
if i select current bill , then below my drop down , i need to show one text filed with place holder ' enter current bill number'
So like wise when ever i select any option from drop down..i need to show some dynamic ui.
How can i achive that ??
ANY HELP WILL BE USE FULL
You can make use of container views to achieve that:
1- Add your drop down menu to any view controller you want.
2- Add a container view under that drop down menu and using auto layout make that container view fill the place that you want it to be switchable/dynamic.
3- Redo step 2 as many times as the items of the drop menu.
4- Create IBOutlets for each of your container views and and an IBAction for your drop down menu.
5- In the IBAction of your drop down menu, set isHidden property of one container view to false and set it to true for the others based on the user's selection from the drop down menu.
Here is a tutorial that explains that with a simple example.
Just drag and drop viewcontrollers in your storyboard for your current bill,water bill., bike bill, loan bill, phone billetc.
And when ever you change the option from your drop down list use below code to add your required controller as child controller.
let currentBill = self.storyboard?.instantiateViewController(withIdentifier: "currentBill") as! CurrentBillVC
// remove other views
for k in 0..<self.parentView.subviews.count {
self.parentView.subviews[k].removeFromSuperview()
}
self .addChildViewController(currentBill)
// Add view to your maincontroller i named it parent view in which you want to display other controller w.r.t your drop down list.
self.parentView .addSubview(currentBill.view)
currentBill.didMove(toParentViewController: self)

How to Make UITableViewSections respond to a click to bring up another view controller, using NSFetchedResultsController and Core Data

I have a fairly simple but working app right now; it's my first app and I'm working through the processes.
There are 4 Tab Bars with Table View controllers with a plus button on the top right. The user clicks that button and is presented modally with a Modal View Controller. They are asked to fill in 4 sets of information in text fields and when they click save, it saves it to the Core Data database, dismisses the View and adds that information to the Table Views. Let's call the items that the user fills in:
Name
Title
Date
Amount
The 4 tab bars are just different views of the same information. For example, Tab Bar 1 has Date as the section header and name, Amount and Title in each row. Nice and easy.
Tab Bar 2 has Name in the section title with Date, Amount and Title in the row. Tab Bar 3 has Title in the section title, etc. You get the idea.
Rather than just doing this though, in Tab 2, 3 and 4, I want to actually JUST have the section headers as buttons of some form that when clicked, takes a user to that particular entry. For example, in Tab Bar 2, I have the name as the section - I want to remove the rows associated with that entry and have just sections (or buttons) with the Names; I click on a name and it takes me to another view controller which will contain all of the Title, Amount, Dates, information, etc.
My question is, what's the best way to go about this approach of removing the rows in the sections and somehow making the sections clickable buttons?
My thinking is rather than use tableViews, use buttons, etc, but is there an elegant way to do this with having already implemented NSFetchedResultsController for each of the table views in each of the Tab Bars.
Any assistance would be massively appreciated.
Thanks,
EDIT:
I have just thought of a possible way to achieve this and it would be great if anyone could validate my thoughts. Rather than create a button, have a UICollectionView in the Tab 2, 3 and 4 providing the attributes from Core Data. So the UICollectionView for tab 2 can assign the NAME attribute to the label inside the Cell and then it can act like a cell and be clicked on. This sounds like the most feasible way to achieve this.

Is there a way to create a tabbed picker in iOS? Or somehow combine numpad + picker inputs?

I'm looking for a clean way to enable two interactions within one screen.
For example:
1) User clicks on "Add Activity" button
2) User enters a number of standard units (e.g., 10 meters), and then picks an associated activity from a list (e.g., picklist of: jog, run, walk, crawl)
All I can think of right now is creating two separate entry fields - one that calls up numpad, and another that calls up the picker. Is it possible to created a tabbed numpad so that the user completes numerical entry, then just hits 'Activity Type' above the numpad and the element switches to a picker?
Appreciate any inputs!
Not with a stock keyboard. If all you need is a numpad, you ought to be able to implement a very reasonable keyboard out of a few buttons. Add a couple of "tab" buttons, and show/hide the appropriate view: keyboard or picker.

iOS Dropdown Ajax

I’m new to the world of iOS development.
I’m creating a iPad application where I need to have three dropdown (I know there is not dropdown on iOS, i'm doing a analogy with html).
The user selects the value from the first dropdown and the second will be loaded with respective values (from an external source). Then user selects one value from the second dropdown and the other dropdown will load values so the user can choose.
My question, if this was a web application I would use 3 dropdown Ajax, but on iPad applications there is no dropdown. What is the best controller to do this on a iPad application?
You have to use UITableview for that...you can take three table view or take only one tableview and set frame according to your requirement dynamically...then once you select any row from 1st table..using that value please fetch value for another table (for another drop down value list)....All The best!!
iOS typically uses a combination of navigation controllers and table view controllers for this. When the user selects an item in the table the entire things scrolls off the screen to reveal the next table ('menu').
You see this all the time in iPhone apps and in the master view of split view controllers on the iPad.
I'd recommend that you buy a book such as 'iPhone 4 development' to get you started. There are many great books available.
Tim

Resources