What do people do in this scenario
- Lets say you have a screen with 7-8 buttons, so instead of displaying 7 buttons in a screen which looks ugly, what other options do you receommend. Picker is one option, similar rto date picker, we can display one picker with 1 column which displays all button texts. Any recommendations on using other controls.
I have a black background, so putting a picker might not be a good option.
Thanks for any help
UITableView could be a good option
I think the picker is the most ridiculous looking control that Apple has ever created. I would go with Daniel's idea and use a UITableView. If you find that you rather like the picker functionality, just throw a UITableView into a UIScrollView. It will look ten times better.
Related
I'm new to iOS development and am trying to build something like the screen below:
If I was doing it in Android, I can easily build the above UI in a few minutes. However, I don't know how to go about it with iOS.
I understand that the whole ViewController can be embedded in a navigation controller, which produces the title bar above. What about the bottom part though? I'm thinking of using something like a grouped UITableView but I'm not sure, since every cell will have very different contents:
A search bar, perhaps a subclassed UISearchBar, which I also don't know how to customize--the Search button at the right is required but isn't in the default UISearchBar. When the user taps on it, the UISearchBar must be translated to the navigation bar, no need to display a UITableView of suggested results. I don't know how to do that, too.
A button that, when tapped, flies in a modal from the bottom (I imagine it to be another ViewController with a grouped UITableView), to allow the user to choose from defined locations. Once selected, the modal closes and the button text is replaced with the selected location. This sounds much easier to do.
A header ("Item categories") and the list of categories, which may change in number. If the parent isn't a grouped UITableView, I think this part can be a UILabel and a non-scrolling UITableView with a height that changes depending on how many cells it has. If there are plenty table cells that don't fit given the screen's height, everything below the navigation bar can be scrolled vertically. That, I also don't know how to do.
If anyone can just guide me to what native iOS components I can use to build the above screen, and maybe a couple of tutorials to the things I just said I don't know how to do, I'd appreciate it.
You said it right .All the basic info you need is with you.
To build a searchbar like that i dont think you have to subclass it.
Bottom comprises of tableview.
Actually these Questions are seperately available in SO itself.So search seperately for your needs and you can achieve whatever you want
One basic principle : You cant achive anything by just thinking.Trying and get to it and if you have any issues look forward at it.All the issues will have an answer on the way.
Lots of components you need there.. Search Bar, UIPickerView and UITableView. I would like to give you some pointers.
1) You can refer http://www.appcoda.com/how-to-add-search-bar-uitableview/ for Search bar
2) When clicking on the Button, you can bring up a UIPickerView instead of another controller. For that you can refer http://www.techotopia.com/index.php/An_iOS_5_iPhone_UIPickerView_Example
3) You can use a normal Tableview with a single section, configure the section header to display Item categories.
You are asking too much to ask how to do every component of your UI. I will just answer a little.
Yes, a grouped table view is a good design. I am using a grouped table view for varying types of input. I have an actual table, with rows that can be added, and deleted, and contain an editable text area. Then I have three groups that only really show one piece of content each: two are sliders and one is a switch.
For choosing the location, pushing another view controller on your navigation stack would be the more typical way to handle it. You will save some effort that way, with some buttons and behaviors built in, but a modal view controller is not much harder. I'm not sure if you can make a navigation view fly in vertically, but does your app have to be frame-for-frame identical to the android version?
is there a way to have the date picker smaller or with different size?
I have been trying to make it small programatically but it seems like there is no luck.
any help?
no you cannot
if you want you may customize your own date picker using pickerview
Date picker is not customizable.
If you have lots of time you could create your own UIView object (with your custom background) with one (or more, better if configurable) UITableView scrolling-paged inside (and other object, like the light blue indicator) and show this UIView inside a UIActionSheet (you will get animation in/out for free).
It's not a easy solution, but it is.
If you'll create this component, any code released open source is really appreciated.
I will have UInavigation controller and UITableView, it will be long scrolling list,for each cell I need to show some radiobuttons. checkboxes, date entries and textboxes. Since Iphone does not have these controls and considerding that I already Use UITableview and UINavigationContoller what is the best and easy practise here to show radiobuttons and checkboxes?
pickerviews and putting them into a alertshield
show them as tablelist items and multi/checkable
using pickerview popping up from bottom as I have seen in some apps but dont know how to do that?
The second choice is probably your best one. Look at how the Settings app lays things out: that should give you a good idea how to organize your options. Checkbox-able items are usually UISwitches; option-button-y ones are usually rows in a table view, with their corresponding UITableViewCell set to use UITableViewCellAccessoryCheckmark as their accessoryType if they’re selected.
Radio Buttons: If the user has to select one among many items, you can use UISegmentedControl.
Note: This method won't be a good solution if there are lot of items the user has to choose from.
Check Boxes: You can implement this using UIButtons with some images like check boxes or something, and with some logic.
Note: You can also implement radio buttons in this method.
Checkboxes can be done by subclassing UIControl. For future use I've already done this and all you have to do is download the link below from GitHub. Also includes a sample project on how easy it is to use:
https://github.com/Brayden/UICheckbox
I require a custom date picker, essentially just want to remove the graphics in the IOS version but retain the 3 column date scroll. Does it need to be re-built from scratch (all research points to yes) , or is it possible to just disable or swap the images.
I haven't tried it myself, but maybe you could just add a UIImageView above the datepicker with a transparent section for the scrolling sections to show through.
Change UIPickerView background check adam's answer there relating to picker views.
I have altered those before for a picker, so the datepicker might be similar.
I don't think you can change the images of a UIDatePicker. UIPickerView you can, but as you say, you would lose a lot of functionality.
I have an iPhone application which is, in essence, a list. There is a UINavigationBar at the top, and then there is a UITableView which holds the list. I'd like to have an option in some way or another of allowing the user to sort the list in different ways. So, in my mind, I picture having a NavigationItem on the UINavigationBar that, when touched, a little pop up dialogue comes up. You select the "sort" you want, a check mark appears next to it, and the dialogue goes away.
I'm not really sure how to do this. I tried creating a UIView, adding a UIViewController onto it (which held this list of different "sort" parameters (ex. sort alphabetically, sort by date, etc) in a UITableView. But the UITableView isn't responding to any touches, and I'm not sure why.
Does anyone have an idea for using Apples wonderful interface for having an option like this? I can't use a UISegmentedControl below the UINavigationBar, because there are 5 possible options, and I can't fit all that in a single UISegmentedControl.
This sounds like a job for the UIPickerView. You could just slide one up from the bottom of the view whenever that button is pressed. I've done this in the past and it works well.
You won't get a checkmark, but if you want a pop-up I suggest using a UIAlertView.
Have you looked into UIActionSheet at all? https://developer.apple.com/documentation/uikit/uiactionsheet
It seems like it might be a good fit for this approach. The action sheet will be a bit tall since you will have 5-6 buttons in it, but it should get the job done and they are really easy to implement.
The way you are approaching it with displaying another view with its own UITableView in it would work also, but it doesn't seem like the best approach to me. Granted, if you are set on going with that approach, provide us with some code so we can try to figure out why the UITableView isn't responding to touches.