[TIMOB-8937] iOS: Feature to add the scroll enable/disable property to a scrollview
| GitHub Issue | n/a |
|---|---|
| Type | New Feature |
| Priority | High |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2012-12-21T05:40:30.000+0000 |
| Affected Version/s | Release 2.1.0 |
| Fix Version/s | Sprint 2012-14 API, Release 3.0.0 |
| Components | iOS |
| Labels | api, module_scrollview, qe-review, qe-testadded |
| Reporter | Varun Joshi |
| Assignee | Vishal Duggal |
| Created | 2012-04-30T17:51:38.000+0000 |
| Updated | 2012-12-21T05:40:30.000+0000 |
Description
It has been requested to add a new property to enable/disable scroll in a scrollview just like it is in a tableview.
The following change could work (provided by the customer):
In the TiUIScrollView.m add the following code:
{noformat}
-(void)setScrollable_:(id)args
{
[[self scrollView] setScrollEnabled:[TiUtils boolValue:args def:YES]];
}
{noformat}
Please make sure that this property is available on all platforms before resolving this ticket.
Test Case
var win = Ti.UI.createWindow({ backgroundColor: '#fff' }); var sv = Ti.UI.createScrollView({ width:100, height:200, contentWidth:'auto', contentHeight:'auto', borderColor:'green', borderWidth:1 }) for (var i=0;i<40;i++){ var top = 40*i; var v = Ti.UI.createLabel({ backgroundColor:'white', width:100, height:40, top:top, text:'Label '+i, textAlign:Ti.UI.TEXT_ALIGNMENT_CENTER }) sv.add(v); } win.add(sv); var b1 = Ti.UI.createButton({ height:40, left:0, bottom:0, title:'Scrolling Enabled?' }) var b2 = Ti.UI.createButton({ height:40, right:0, bottom:0, title:'Toggle' }) b1.addEventListener('click',function(e){ if(sv.scrollingEnabled){ alert('TRUE'); } else { alert('FALSE'); } }) b2.addEventListener('click',function(e){ sv.scrollingEnabled = !sv.scrollingEnabled; }) win.add(b1); win.add(b2); win.open();Pull pending https://github.com/appcelerator/titanium_mobile/pull/2518
Verified fixed with mobile sdk-2.2.0.v20120810080115 Titanium Studio, build: 2.1.1.201207271312
Re-opening to edit label