Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-19203] iOS9: UIPickerView and UIDatePicker are now resizable

GitHub Issuen/a
TypeImprovement
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2015-09-04T04:49:10.000+0000
Affected Version/sn/a
Fix Version/sRelease 5.1.0
ComponentsiOS
Labelsdatepicker, picker
ReporterChee Kiat Ng
AssigneeHans Knöchel
Created2015-07-10T03:48:12.000+0000
Updated2015-10-13T21:16:20.000+0000

Description

{quote} UIPickerView and UIDatePicker are now resizable and adaptive—previously, these views would enforce a default size even if you attempted to resize them. These views also now default to a width of 320 points on all devices, instead of to the device width on iPhone. Interfaces that rely on the old enforcement of the default size will likely look wrong when compiled for iOS 9. Any problems encountered can be resolved by fully constraining or sizing picker views to the desired size instead of relying on implicit behavior. {quote} Demo code:
var win = Ti.UI.createWindow();
var picker = Ti.UI.createPicker({height: 500});
var data = [];

data[0]=Ti.UI.createPickerRow({title:'Bananas'});
data[1]=Ti.UI.createPickerRow({title:'Strawberries'});
data[2]=Ti.UI.createPickerRow({title:'Mangos'});
data[3]=Ti.UI.createPickerRow({title:'Grapes'});

picker.add(data);
picker.selectionIndicator = true;

win.add(picker);
win.open();
On iOS8, nothing should change and the height is ignored. On iOS9, the height should be honored and the picker should resize.

Comments

  1. Hans Knöchel 2015-09-02

    [~cng] So our job is to size them back to full-width by default and apply the "width" property to the picker? A little bit more context would be great here! :-)
  2. Chee Kiat Ng 2015-09-03

    1. Make sure they look normal by default on iOS9 on all device types. 2. expose the new iOS9 properties or methods that allows resizing, and 3. make sure there is parity between Android and iOS. There hasn't been much info provided by Apple on what the new methods and properties are and what they do, it's best to do some investigation and see how they can improve our current implementation of picker view while maintaining parity with Android. Maybe they don't help at all then we can just include our investigation result here in this ticket.
  3. Hans Knöchel 2015-09-03

    [~cng] Ok, experiences: - Picker is currently fixed to 320px, but full width works well if you provide width: '100%' to the Picker. Happens in both iOS8 and 9. initWithFrame:CGRectMake(0, 0, 320, 228) can removed and the behavior is, that iOS8 shows full-width and iOS9 320px since the default width of 320px in iOS9. - I don't see any new methods, properties or delegates in the documentation - Parity between iOS and android is difficult, since the *native* android pickers are not comparable to the iOS pickers. I will do some more research on the researching and awaiting your feedback before editing the frame. EDIT: "Resizeable" just means, that we now can change the width and height as we want. I will check the existing ways and test some cases.
  4. Hans Knöchel 2015-09-03

    Implemented dynamic height for iOS9+ and a fallback to iOS8 which uses the constraints (width: 320px, height: 228px) used before. Also provided an update in the docs to inform the developer about the changes. PR: https://github.com/appcelerator/titanium_mobile/pull/7121
  5. Chee Kiat Ng 2015-09-04

    CR and FT passed. PR Merged.
  6. Harry Bryant 2015-10-13

    Verified as fixed, UIPickerView & UIDatePicker are now resizable, but only applies to iOS9 sims / devices. When building app to iOS8, the height is ignored. OSX El Capitan 10.11 Studio: 4.3.1.201509302304 Ti SDK: 5.0.2.GA Appc NPM: 4.2.1-1 Appc CLI: 5.1.0-38

JSON Source