Make dropdown menu in IOS app with swift - ios

How can I make a drop down menu in my swift IOS app that has different options that the user can select, whatever they select displays in a label above the menu. Example: drop down menu to select age in an app. Or like the select size and quantity option in the following link http://store.nike.com/us/en_us/pd/roshe-run-shoe/pid-463712/pgid-943980.
Please let me know if you can help me accomplish this, Thanks!

I achieved similar feature on Objective-C, hope the same concept can be applied on swift.
I actually subclass a UITableView with some customized functions and variables, then instantiate the class with desired coordination and dimension and use UITableViewDelegate methods to trigger the events needed.

Related

Best way to select multiple items in iOS?

I'm writing an iOS app in Swift. I want to display a bunch of items (team names) and want the user to select many of them for a league. What's the best way to do this? I could use a picker view, and take each one out as they are selected. I would like to use checkboxes, but there is nothing built in for that. Maybe a table view with multiple checking? Has anyone already done this and have a good method to use?
I think the best/easiest way to do it is with a UITableView and all you have to do is enable multiple cell selection. Then you can retrieve them by using
table.indexPathsForSelectedRows

How to make a menu (multiple button?) iOs

I am new in the development of iOS with swift, for the moment everything goes well but there is one thing that I blocked.
How this kind of menu?
How do you call this ? Because I do not even know what to look for because I do not know his name: /
Sorry for my bad english and thank you for your help :)
This can be made by using click on button open a view or open a tableview inside the table view put the label on each row and after that use didselectrowatindexpath method of tableview for click on each row open the new page or viewcontroller.
You can use table view to show dropdown menu. Show tableview on click and hide when select row. this is the basic concept. and if you not want to code your self then there many third party libraries available on github like DropDownMenu or dropdownment etc.
Note : standard way in ios for this kind of stuff(drop down or selection from multiple option) is UIPickerview, so you can use this also it very easy. so if not required to use hardcoded dropdown then pickerview is best option.
hope this will help :)

iOS UIButton or Single Row UITableView For Dropdown Like Thing?

For iOS 7 and iOS 8, we're implementing these things that look like drop-downs, but each just launch a modal window.
What makes more sense, using 3 UIButtons, 3 UITableViews with 1 row, or something else? In the past, there would be more than one of these all lined up, so I would put them in a UITableView and set the accessoryView of the UITableViewCell. Using the cell was nice, but three UITableViews seem like overkill here and a maintenance hassel.
The closest post I found regarding this was one about using an UITableViewCell outside of UITableView
What would make the most sense is to follow the iOS design guidelines. Instead of trying to create custom dropdown menus (or worse: showing a drop down menu, but displaying a modal view when the user is expecting a drop down view), that UI could be replaced with 1 UITableView that has 3 UITableViewCells in it. The text on each cell would be the name of the setting to be changed and selecting the cell would push segue to the next page. This will give the app a uniform iOS UX; allowing users to know exactly how to use your app because it works similarly to other apps on their phone. Check out the Settings app on the simulator to see what I am describing.
I don't see any advantage to using a UITableView or a UITableViewCell. I think this is clearly a case for three UIButtons. You can set constraints to keep them nice and clean. One cool thing that might be worth investigating is using a unicode character for the downward arrow. That way you could have the tap feedback on the whole "thing" as you called it.
When I need to create sort of dropdown menus, I usually take advantages from UITableView, one above all is when you will need to add one or more selections in the dropdown you just need to change the data model.
UITableViewCells are easily customizable that means that you can create almost everything you want.
I think that your design doesn't adapt well to a mobile application, those kind of menu are more web style, with 3 buttons and a UIPickerView you can really improve the user experience and also adapt in a really easy way on the ipad embedding the picker in a UIPopoverController.
as i agree with #keithbhunter, but still if you want then may this links will help you.
http://code4app.net/ios/DXPopover/54741ca3e24741c56db03ca0
https://www.cocoacontrols.com/controls/kxmenu
https://www.cocoacontrols.com/controls/nidropdown

iOS Contact app style edit user information form

I want to create a page where user can edit their information like the iOS Contact App. However, from my understanding, the UITableView does not offer that option. It only allows you to insert cell, delete cell, rearrange cell (Am I correct?). Is there an easy way to do this?
I solution I can think of is to create a new cell for each user info, but it would be very tedious and messy because I will have to create custom cell for each user info type. If I have 5 cell type, then there'll be 15 additional files(.m .h .xib) for me to create. Or I can create the prototype cell in storyboard, but I don't know now to prevent it from reusing the cell and losing my data in the process.
If it's for contact, you can try to use some of AddressBookUI framework built-in view, like the ABPersonViewController which allow to view and edit a contact.
https://developer.apple.com/library/ios/DOCUMENTATION/ContactData/Conceptual/AddressBookProgrammingGuideforiPhone/Chapters/UI_Controllers.html#//apple_ref/doc/uid/TP40007744-CH5-SW1
Otherwise, if you need a custom form, there is not built-in iOS control to do this.
Interface Builder can help you using static cells (if you can support subclassing UITableViewController) or via prototype cell for each type of field (date, string, toggle, ...).
Also, You can check some github project which try to solve this:
https://github.com/brunow/FormKit.m
https://github.com/B-Sides/ELCTextFieldCell
https://www.cocoacontrols.com/search?utf8=✓&q=form
Hugues

Creating a user configurable UI in ios

I'm writing an app in which there will be user defined "categories" which will consist of a label and each category will have a user defined list of "items" which will be UIButtons. I want a user to be able to layout the user interface to their choosing. What's the best way to implement this? Any example code out there?
Edit: Just to make myself clear, I have groups of buttons with a group "heading". I'd like users to be able to move these buttons around inside a group and also to arrange the groups as a whole. It's okay if they have to enter some sort of "edit mode" to move things around.
Probably the easiest way is to use editable UITableViews with UITableViewStyleGrouped style (just like Settings.app). Then you can add, remove and arrange items inside groups. You can show it as "edit mode" view.
Here are some useful posts about it:
iOS 5: Drag and Drop Between UITableViews
Tutorial on How to drag and drop item from UITableView to UITableView
iPhone UITableView Tutorial: Grouped Table
You could use touch handling methods to enable drag-drop type of rearranging of buttons. UIPanGestureRecognizer is a useful class for this. A reference for this can be found here.

Resources