Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-18283] iOS: ImageView repeatCount is not honored

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2014-12-23T16:22:25.000+0000
Affected Version/sRelease 3.4.1, Release 3.5.0
Fix Version/sRelease 4.0.0
ComponentsiOS
Labelsimageview
ReporterVishal Duggal
AssigneeVishal Duggal
Created2014-12-22T19:48:41.000+0000
Updated2015-01-15T01:18:38.000+0000

Description

Test Code
Titanium.UI.setBackgroundColor('#000');
 
var win2 = Titanium.UI.createWindow({  
    title:'Test',
    backgroundColor:'#fff',
    fullscreen:true,
    layout:'vertical'
});

var theImages = [
'images/campFire01.gif',
'images/campFire02.gif',
'images/campFire03.gif',
'images/campFire04.gif',
'images/campFire05.gif',
'images/campFire06.gif',
'images/campFire07.gif',
'images/campFire08.gif',
'images/campFire09.gif',
'images/campFire10.gif',
'images/campFire11.gif',
'images/campFire12.gif',
'images/campFire13.gif',
'images/campFire14.gif',
'images/campFire15.gif',
'images/campFire16.gif',
'images/campFire17.gif',
];


var container = Ti.UI.createView({height:Ti.UI.SIZE,top:20,layout:'horizontal',width:Ti.UI.SIZE});

var b1 = Ti.UI.createButton({title:'START',width:70});

var label = Ti.UI.createLabel({text:'Reverse:',left:10});
var sw = Ti.UI.createSwitch({value:false,left:10});

container.add(b1);
container.add(label);
container.add(sw);

win2.add(container);
  
var image2 = Titanium.UI.createImageView({
  repeatCount:3,
  images: theImages,
  width:160,
  height:240,
  top:5,
  borderWidth:1,
  borderColor:'black'
});
 
win2.add(image2);

var checkIndex;
var count;

b1.addEventListener('click',function(e){
  if(image2.animating == true) {
    image2.stop();
  } else {
    image2.reverse = sw.value;
    if(image2.reverse == true) {
      checkIndex = 0;
    } else {
      checkIndex = theImages.length - 1;
    }
    count = 0;
    image2.start();

  }
});


var l2 = Ti.UI.createLabel({top:5});
var l3 = Ti.UI.createLabel({top:5});

win2.add(l2);
win2.add(l3);

image2.addEventListener('change',function(e){
  l2.text = 'Showing Index '+e.index;
  if(e.index == checkIndex) {
    count++;
    l3.text = 'Completed Loop '+count;
  }
});
 
image2.addEventListener('stop',function(e){
  l3.text = 'STOPPED';
  sw.enabled = true;
  b1.title = 'START';
});

image2.addEventListener('start',function(e){
  l3.text = 'STARTED. Loop Count '+image2.repeatCount;
  sw.enabled = false;
  b1.title = 'STOP';
});

win2.open();

Attachments

FileDateSize
images.zip2014-12-22T19:50:09.000+00001019025

Comments

  1. Vishal Duggal 2014-12-22

    Resources for test
  2. Vishal Duggal 2014-12-22

    Pull pending master - https://github.com/appcelerator/titanium_mobile/pull/6525
  3. Ewan Harris 2015-01-15

    Verified fix on : Mac OSX 10.10.1 Appcelerator Studio, build: 3.4.1.201410281743 Titanium SDK build: 3.6.0.v20150114112521 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 attached code and images ran on both devices, the image repeated fro the correct number of times. Closing ticket

JSON Source