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.
Related
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.
Right now I have a standard UITableView that is empty by default and the user can add cells to it.
I noticed this app starts with no cells and is empty (like you cant see lines) but my standard view always has the lines like standard table view.
I thought it may be a grouped table style but the edges are not curved like the grouped style is.
Does anyone have any ideas?
The lines between cells are controlled by the separatorStyle property of your tableView. To remove the lines simply set:
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
Your other options are UITableViewCellSeparatorStyleSingleLine and UITableViewCellSeparatorStyleSingleLineEtched.
You can hide the separator lines by setting their color to the same color as your background, e.g.
tableView.separatorColor = [myApp theColorOfMyBackground]; // A UIColor object
Make sense?
The cells in your picture are likely custom cells, but you didn't really ask about that. :-)
EDIT: As noted in another answer seperatorStyle can be used to simply "turn off" the lines. That's a better way to do it.
This is a good question. +1 What app is this? Does the view you show above actually "scroll" even though only 2 rows are showing? I am wondering if it is a truly a table view. It could be a series of UIViews added to a UIScrollView with a dark background.
Assuming the programmer knows how tall the "rows" are, then they can add them with a pixel spacing over the charcoal background. With the UIScrollView, the programmer can define the contentSize.
If more views were added to extend past off the screen and the contentSize was appropriately defined, the USScrollView would automatically allow scrolling at that point.
Selecting a "row" could be easily handled by UIGesture controls on each UIView.
*EDIT
After seeing the app, Delivery by JuneCload, it is definitely using a UITableView with custom cell views. As Mark and Matt have answered.
I am wondering what is the good way to design interfaces such as the one in the Settings view on an application, for instance :
What I want to do is the nice round rectangle to separate categories and horizontal line separators between categories, I can have a label, text field, slider or any other control in each line...
Do we need to use an image in the background, that seems quite dirty to me, and I cant find any control in IB that seem to do the same kind of layout.
So, how is this done?
Thanks!
Use a UITableView and set it's style to UITableViewStyleGrouped. Remember that the standard UITableViewCell's will just let you show some text and you may need to create custom UITableViewCell's to achieve more (for example, a on-off switch).
If you wan't to customise it you can add a background image. To do this, place a UIImageView behind the UITableView and make sure you set the UITableView background colour to clear:
theTableView.backgroundColor = [UIColor clearColor];
To seperate the categories make use of the "sections".
Basically, you can use grouped table.You can have sections with different/same number of rows.
I have a requirement to use date picker in my applicaiton.
I have lot of controlles in my view that..i cannot add the date picker with the default size.
Can anyone please suggest me that how can I reduce the size of the picker?
i tried it with Ib, but size option is disabled in IB?
You can change the size of your datepicker with changing the frame of the DatepIcker, but this will clip most of the datepicker and is not a good idea. Try to add your datepicker in a modal view instead.
If you create UIPickerView in your code then you can use -initWithFrame to set its frame explicitly (see this question) - in the answer provided there stated that some "visual glitches" may appear with this approach.
As a second option you can adjust picker's frame by applying appropriate CGAffineTransform to it ( I have not tested it much but it seems to work fine):
picker.transform = CGAffineTransformMake(0.5, 0, 0, 0.5, -80, 0);
This (somewhat dummy) code scales UIPickerView to a half size and applies translation to place the picker to the left side of the screen. You can play with different transform values to get the effect you want.
Edit: The code above works for UIDatePickerView as well (sorry was not attentive to a question). But as other stated Apple had not made picker's frame (easily) customizable so it may mean that you should consider changing your design to try to use the picker in its proper size to conform to Apple's HIG.
To the best of my knowledge, you can't.
Use setFrame:(CGRect)inRect API of Picker view in viewDidLoad method. But I don't know whether you can resize DatePicker!!!
You can change tha size of picker view using CGAffineTransform.
Create a new UIView and apply transform. then add the picker view to the new UIView. Then add this to your main view.
UIView* transformView = [[UIView alloc] initWithFrame:CGRectMake(75.0f, 344.0f, self.pickerView.frame.size.width, self.pickerView.frame.size.height)];
transformView.transform = CGAffineTransformMakeScale(0.60f, 0.60f);
[transformView addSubview:self.pickerView];
[self.view addSubview:transformView];
But aacording to Apple's documentation,
A picker is a generic version of the date picker. As with a date picker, users spin the wheel (or wheels) of a picker until the value they want appears. The overall size of a picker, including its background, is fixed at the same size as the keyboard on iPhone.
Link: https://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/MobileHIG/UIElementGuidelines/UIElementGuidelines.html#//apple_ref/doc/uid/TP40006556-CH13-SW1
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.