Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-16938] iOS: Font property doesn't work for Picker and PickerColumn

GitHub Issuen/a
TypeNew Feature
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2014-11-17T22:04:43.000+0000
Affected Version/sRelease 3.3.0
Fix Version/sRelease 4.0.0
ComponentsiOS
Labelsparity, qe-3.3.0, qe-testadded
ReporterPriya Agarwal
AssigneeChee Kiat Ng
Created2014-05-09T06:16:35.000+0000
Updated2015-01-26T21:36:58.000+0000

Description

Steps to reproduce: 1. Copy Paste the code in app.js and run the app on iOS device. Expected Result: 1. Must observe the difference in font size than normal. Actual Result: 1. No differences appear. Font Size appears the same. Working fine for Android. See the issue TIMOB-14007
var win = Ti.UI.createWindow({
  backgroundColor: 'white',
  exitOnClose: true,
  fullscreen: false,
  title: 'Use picker to make selection'
});

var fruit = [ 'Bananas', 'Grapes', 'Blueberries', 'Strawberries' ];
var color = [ 'blue', 'red', 'yellow', 'white' ];

var column1 = Ti.UI.createPickerColumn({font: {fontSize: 40}});

for(var i=0, ilen=fruit.length; i<ilen; i++){
  var row = Ti.UI.createPickerRow({
    title: fruit[i]
  });
  column1.addRow(row);
}

var column2 = Ti.UI.createPickerColumn();

for(var i=0, ilen=color.length; i<ilen; i++){
  var row = Ti.UI.createPickerRow({
    title: color[i]
  });
  column2.addRow(row);
}

var picker = Ti.UI.createPicker({
  columns: [column1, column2],
  selectionIndicator: true,
  useSpinner: true, // required in order to use multi-column pickers with Android
  top:50
});

function pickerDefaults(obj){
  // on iOS, must be after picker has been rendered
  picker.setSelectedRow(0, 2, false);
  picker.setSelectedRow(1, 3, false);
}

win.add(picker);
win.open();
Test case for Date Picker:
Ti.UI.backgroundColor = 'white';
var win = Ti.UI.createWindow({
  layout: 'vertical'
});
  
var picker = Ti.UI.createPicker({
  type:Ti.UI.PICKER_TYPE_DATE,
  minDate:new Date(2009,0,1),
  maxDate:new Date(2014,11,31),
  value:new Date(2014,3,12),
  font: {fontSize: 40},
  top:50,
  useSpinner: true
});
  
win.add(picker);
win.open();

Comments

  1. Ingo Muschenetz 2014-08-14

    3.4.0 is moved forward, and 3.5.0 is taking its place in the calendar.
  2. Chee Kiat Ng 2014-11-10

    For iOS, font property cannot be implemented for Date Pickers. It can only be done on picker of type Titanium.UI.PICKER_TYPE_PLAIN, and specifically in PickerRow. PR here: https://github.com/appcelerator/titanium_mobile/pull/6330 Above PR plus formatting fix: https://github.com/appcelerator/titanium_mobile/pull/6361
  3. Chee Kiat Ng 2014-11-10

    Edited test case:
       var win = Ti.UI.createWindow({
         backgroundColor: 'white',
         exitOnClose: true,
         fullscreen: false,
         title: 'Use picker to make selection'
       });
        
       var fruit = [ 'Bananas', 'Grapes', 'Blueberries', 'Strawberries' ];
       var color = [ 'blue', 'red', 'yellow', 'white' ];
        
       var column1 = Ti.UI.createPickerColumn();
        
       for(var i=0, ilen=fruit.length; i<ilen; i++){
         var row = Ti.UI.createPickerRow({
           title: fruit[i],
           font:{fontSize:40, fontWeight:'bold'}
         });
         column1.addRow(row);
       }
        
       var column2 = Ti.UI.createPickerColumn();
        
       for(var i=0, ilen=color.length; i<ilen; i++){
         var row = Ti.UI.createPickerRow({
           title: color[i]
         });
         column2.addRow(row);
       }
        
       var picker = Ti.UI.createPicker({
         columns: [column1, column2],
         selectionIndicator: true,
         useSpinner: true, // required in order to use multi-column pickers with Android
         top:50
       });
        
       function pickerDefaults(obj){
         // on iOS, must be after picker has been rendered
         picker.setSelectedRow(0, 2, false);
         picker.setSelectedRow(1, 3, false);
       }
        
       win.add(picker);
       win.open();
       
  4. Ewan Harris 2015-01-26

    Verified fix on: Mac OSX 10.10.1 Appcelerator Studio, build: 3.4.1.201410281743 Titanium SDK build: 3.6.0.v20150122144134 Titanium CLI, build: 3.4.1 Alloy: 1.5.1 Xcode 6.1.1 iPhone 6 (8.1), iPad Air 2 (8.2b4) Using the provided code built to both devices, font property can now be set. Closing ticket.

JSON Source