Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-10450] iOS: Feature: Expose setZoomScale:animated: method

GitHub Issuen/a
TypeNew Feature
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-08-29T16:12:01.000+0000
Affected Version/sRelease 3.0.0
Fix Version/sSprint 2012-17 API, Release 3.0.0
ComponentsiOS
LabelsSupportTeam, api, module_scrollview, qe-testadded
ReporterEduardo Gomez
AssigneeBlain Hamon
Created2012-08-15T09:40:58.000+0000
Updated2013-08-27T11:21:37.000+0000

Description

Feature

Enable setZoomScale:animated: so scrollView can be animated.

setZoomScale:animated:

A floating-point value that specifies the current zoom scale. - (void)setZoomScale:(float)scale animated:(BOOL)animated

Apple release docs

http://developer.apple.com/library/ios/#documentation/uikit/reference/UIScrollView_Class/Reference/UIScrollView.html

The case: zoomScale property cannot be animated on scrollview

var win = Ti.UI.createWindow();

var scroll = Ti.UI.createScrollView({
	top: 0,
	bottom: 0,
	left: 0,
	right: 0,
	maxZoomScale: 5,
	minZoomScale: 1
});
win.add(scroll);

var img = Ti.UI.createImageView({
	width: 320,
	height: 320,
	image: 'http://www.ryanboden.com/wp-content/uploads/2011/07/jay-z-and-kanye-west-watch-the-throne.jpg',
	defaultImage: 'none',
	hires: true,
	
});
img.addEventListener('doubletap', function(e){

	scroll.animate({
		zoomScale: 1,
		duration: 300
	});

        //zoomScale only works on setZoomScale
        //which has the animated parameter to perform the animation        
        //scroll.setZoomScale( 1, { animated: true} );

});

scroll.add(img);

win.open();

Comments

  1. Max Stepanov 2012-08-29

    PR merged https://github.com/appcelerator/titanium_mobile/pull/2818
  2. Tamila Smolich 2012-10-15

    Closing issue. Verified on: OS: Mac OS X Lion 10.7.4 Titanium Studio, build: 3.0.0.201210090117 Titanium SDK, build: 3.0.0.v20121015133920 Device: iPhone 4S (4.3.5)

JSON Source