{ "id": "120604", "key": "TIMOB-15374", "fields": { "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "15703", "description": "2013 Sprint 22", "name": "2013 Sprint 22", "archived": true, "released": true, "releaseDate": "2013-11-01" }, { "id": "15704", "description": "2013 Sprint 22 API", "name": "2013 Sprint 22 API", "archived": true, "released": true, "releaseDate": "2013-11-01" }, { "id": "14982", "description": "Release 3.2.0", "name": "Release 3.2.0", "archived": false, "released": true, "releaseDate": "2013-12-19" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2013-10-29T21:39:48.000+0000", "created": "2013-09-30T02:14:09.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "backgroundSelectedImage", "button", "ios", "module_button", "qe-testadded", "triage" ], "versions": [], "issuelinks": [ { "id": "33383", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "122918", "key": "TIDOC-1382", "fields": { "summary": "Button: disabledColor property needs to be documented", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "Medium", "id": "3" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } }, { "id": "33384", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "122919", "key": "TIDOC-1383", "fields": { "summary": "Button: backgroundSelectedImage property is not documented for iOS", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "Medium", "id": "3" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } }, { "id": "33385", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "122920", "key": "TIDOC-1384", "fields": { "summary": "Button: backgroundDisabledImage property is not documented for iOS", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "Medium", "id": "3" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } }, { "id": "39157", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "120603", "key": "TIMOB-15375", "fields": { "summary": "iOS: Button backgroundSelectedColor/backgroundDisabledColor property", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "subtask": false } } } } ], "assignee": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2014-07-18T15:48:58.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "New backgroundSelectedImage property for iOS button. Workaround made by \"click\" listener and some function for changing backgroundImage doesn't work properly if user hold finger on the button or if user uses more fingers etc. It is hard to fix all these options. For good UX is backgroundSelectedImage necessary.", "attachment": [ { "id": "43522", "filename": "Resources.zip", "author": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2013-10-28T20:53:25.000+0000", "size": 7949, "mimeType": "application/zip" } ], "flagged": false, "summary": "iOS7: Add disabledColor property", "creator": { "name": "sko", "key": "sko", "displayName": "Matej", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "mrahman", "key": "mrahman", "displayName": "Mostafizur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "environment": null, "comment": { "comments": [ { "id": "273375", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Is this a property on native buttons in iOS? Is this only for iOS? Does this property exist/work on other platforms already?", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-09-30T14:30:22.000+0000", "updated": "2013-09-30T14:30:22.000+0000" }, { "id": "273377", "author": { "name": "sko", "key": "sko", "displayName": "Matej", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hi Ingo\r\n\r\n1. If I understand it then yes you can set it by backgroundImageForState (UIControlStateDisabled, UIControlStateSelected etc...)\r\n2. Yes this requirement is only for iOS (iPhone/iPad)\r\n3. This property works on Android, Web Mobile and Tizen. (http://docs.appcelerator.com/titanium/3.0/#!/api/Titanium.UI.Button-property-backgroundSelectedImage)", "updateAuthor": { "name": "sko", "key": "sko", "displayName": "Matej", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-09-30T14:55:49.000+0000", "updated": "2013-09-30T14:55:49.000+0000" }, { "id": "276347", "author": { "name": "ygbr", "key": "ygbr", "displayName": "Ygor Lemos", "active": true, "timeZone": "America/Sao_Paulo" }, "body": "This should be on 3.2.0 as iOS7 basically flattened almost everything, many buttons have flat color backgrounds, that said, with current Ti versions it is impossible to give the user accurate button pressing feedback (unless using a lot of eventlisteners everywhere).\r\n\r\nOn Android this works perfectly and for parity this should exist for iOS as well.\r\n\r\nOn Interface Builder you can configure backgroundColor, backgroundImage and text color (selectedColor) for all those button states: Default, Highlighted, Selected and Disabled.\r\n\r\nSo basically,\r\n\r\nselectedColor,\r\nbackgroundSelectedColor,\r\nbackgroundSelectedImage,\r\nbackgroundFocusedColor,\r\nbackgroundFocusedImage,\r\nbackgroundDisabledColor,\r\nbackgroundDisabledImage\r\n\r\nshould all be mapped to work under iOS as this is possible with the native SDK without using events, simply by setting the color / images on Interface Builder.", "updateAuthor": { "name": "ygbr", "key": "ygbr", "displayName": "Ygor Lemos", "active": true, "timeZone": "America/Sao_Paulo" }, "created": "2013-10-23T14:51:19.000+0000", "updated": "2013-10-23T14:56:10.000+0000" }, { "id": "276348", "author": { "name": "sko", "key": "sko", "displayName": "Matej", "active": true, "timeZone": "America/Los_Angeles" }, "updateAuthor": { "name": "sko", "key": "sko", "displayName": "Matej", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-10-23T14:58:31.000+0000", "updated": "2013-10-23T14:58:31.000+0000" }, { "id": "276652", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Any additional sample code or test cases would be appreciated.", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-10-24T18:38:12.000+0000", "updated": "2013-10-24T18:38:12.000+0000" }, { "id": "276896", "author": { "name": "core13", "key": "core13", "displayName": "Malcolm Hollingsworth", "active": true, "timeZone": "Europe/London" }, "body": "I agree with Ygor, all need mapping if they already exist. Seems like an easy parity gain and makes ios7 state work as it should as well as not creating unforeseen memory leaks with badly coded event listeners.", "updateAuthor": { "name": "core13", "key": "core13", "displayName": "Malcolm Hollingsworth", "active": true, "timeZone": "Europe/London" }, "created": "2013-10-26T08:32:27.000+0000", "updated": "2013-10-26T08:32:27.000+0000" }, { "id": "276999", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Note that we support backgroundSelectedImage, backgroundFocusedImage backgroundDisabledImage properties. Do you have references for the corresponding *Color properties?", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-10-28T18:05:32.000+0000", "updated": "2013-10-28T18:05:32.000+0000" }, { "id": "277029", "author": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Test Case Files attached", "updateAuthor": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2013-10-28T20:53:25.000+0000", "updated": "2013-10-28T20:53:25.000+0000" }, { "id": "277031", "author": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "body": "We already support backgroundImage,backgroundSelectedImage,backgroundDisabledImage properties.\nWe also support color, selectedColor and backgroundColor properties.\nWe will add support for disabledColor property.\n\nWe will not support backgroundDisabledColor and backgroundSelectedColor properties on iOS.", "updateAuthor": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2013-10-28T20:57:55.000+0000", "updated": "2013-10-28T20:57:55.000+0000" }, { "id": "277032", "author": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Pull pending against master\r\nhttps://github.com/appcelerator/titanium_mobile/pull/4870", "updateAuthor": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2013-10-28T20:59:28.000+0000", "updated": "2013-10-28T20:59:28.000+0000" }, { "id": "277080", "author": { "name": "sko", "key": "sko", "displayName": "Matej", "active": true, "timeZone": "America/Los_Angeles" }, "body": "*Vishal Duggal*, please can I ask you why will not support backgroundSelectedColor? On Android this property does work. My problem is (For sure it is not only my problem) that I have in my application approx. 15 buttons with different backgroundColor and everywhere I used backgroundSelectedColor because it is much easier than make 3+ images for one button (iOS) and few next for Android... This property saves a lot of time + space.\r\n\r\n+ What is faster/better for app. performance? Window (Menu) with 6/8 buttons that contain image or 6/8 buttons with bgColor?\r\n\r\nThank you", "updateAuthor": { "name": "sko", "key": "sko", "displayName": "Matej", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-10-29T00:27:35.000+0000", "updated": "2013-10-29T00:35:09.000+0000" }, { "id": "277176", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~sko] The issue is that AFAIK, backgroundSelectedColor is not natively available on iOS. Hacking around this for parity's sake can lead to a very fragile SDK. Can you point to documentation or a simple workaround that suggests otherwise?", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-10-29T17:29:11.000+0000", "updated": "2013-10-29T17:29:11.000+0000" }, { "id": "277178", "author": { "name": "sko", "key": "sko", "displayName": "Matej", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Ou, sorry I didn't know that. I have seen only backgroundImage property as I mentioned above...anyway thanks for clarification.", "updateAuthor": { "name": "sko", "key": "sko", "displayName": "Matej", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-10-29T17:42:35.000+0000", "updated": "2013-10-29T17:42:35.000+0000" }, { "id": "277181", "author": { "name": "core13", "key": "core13", "displayName": "Malcolm Hollingsworth", "active": true, "timeZone": "Europe/London" }, "body": "I am confused by all the comments;\r\n\r\nWill \"backgroundDisabledColor\" be supported and if not what was the reasoning?", "updateAuthor": { "name": "core13", "key": "core13", "displayName": "Malcolm Hollingsworth", "active": true, "timeZone": "Europe/London" }, "created": "2013-10-29T17:51:30.000+0000", "updated": "2013-10-29T17:51:30.000+0000" }, { "id": "277184", "author": { "name": "sko", "key": "sko", "displayName": "Matej", "active": true, "timeZone": "America/Los_Angeles" }, "body": "backgroundDisabledColor will not supported probably for same reason as backgroundSelectedColor (Properties are not available natively on iOS)", "updateAuthor": { "name": "sko", "key": "sko", "displayName": "Matej", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-10-29T17:59:11.000+0000", "updated": "2013-10-29T17:59:11.000+0000" }, { "id": "277191", "author": { "name": "core13", "key": "core13", "displayName": "Malcolm Hollingsworth", "active": true, "timeZone": "Europe/London" }, "body": "Thanks, I just delved further into the classes than I normally feel comfortable with - nothing about background colour states - annoying but true.\r\n\r\nCheers", "updateAuthor": { "name": "core13", "key": "core13", "displayName": "Malcolm Hollingsworth", "active": true, "timeZone": "Europe/London" }, "created": "2013-10-29T18:11:53.000+0000", "updated": "2013-10-29T18:11:53.000+0000" }, { "id": "277210", "author": { "name": "ygbr", "key": "ygbr", "displayName": "Ygor Lemos", "active": true, "timeZone": "America/Sao_Paulo" }, "body": "@Ingo Actually you only have textcolor, background image and shadows to set on IB per button state.\r\n\r\nIn order to change the selected color you need to tinker with the layers that form the button itself and override the Highglighted state layer.\r\n\r\nsomething like:\r\n\r\n{code}\r\n- (void) setHighlighted:(BOOL)highlighted {\r\n [super setHighlighted:highlighted];\r\n\r\n if (highlighted) {\r\n self.backgroundColor = UIColorFromRGB(0x387038);\r\n }\r\n else {\r\n self.backgroundColor = UIColorFromRGB(0x5bb75b);\r\n }\r\n}\r\n{code}\r\n\r\nSo if we want to make parity for this, we should focus on UIControl and play with UIControlStateHighlighted.\r\n\r\nMore on:\r\nhttps://developer.apple.com/library/ios/documentation/UIKit/Reference/UIControl_Class/Reference/Reference.html#//apple_ref/doc/c_ref/UIControlState\r\n\r\n\r\nI've also seen some solutions based on creating an image on-the-fly with the desired color and applying it as the background for the selected state with setBackgroundImage:forState:\r\n\r\nas in:\r\n\r\n{code}\r\n- (UIImage *)imageWithColor:(UIColor *)color {\r\n CGRect rect = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f);\r\n UIGraphicsBeginImageContext(rect.size);\r\n CGContextRef context = UIGraphicsGetCurrentContext();\r\n\r\n CGContextSetFillColorWithColor(context, [color CGColor]);\r\n CGContextFillRect(context, rect);\r\n\r\n UIImage *image = UIGraphicsGetImageFromCurrentImageContext();\r\n UIGraphicsEndImageContext();\r\n\r\n return image;\r\n}\r\n\r\n[myButton setBackgroundImage:[self imageWithColor:[UIColor greenColor]] forState:UIControlStateHighlighted];\r\n{code}\r\n\r\nAFAIK those are the only current ways to achieve a backgroundSelectedColor on iOS.\r\n", "updateAuthor": { "name": "ygbr", "key": "ygbr", "displayName": "Ygor Lemos", "active": true, "timeZone": "America/Sao_Paulo" }, "created": "2013-10-29T18:56:04.000+0000", "updated": "2013-10-29T18:56:04.000+0000" }, { "id": "281335", "author": { "name": "wluu", "key": "wluu", "displayName": "Wilson Luu", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as fixed. Verified the Button.disabledColor is working as expected i.e. if a button is disabled, then the button's text color will be set to Button.disabledColor property.\n\nAlso, the disabledColor property works on both iOS 6 and iOS 7 devices.\n\nTested on:\n\nTitanium Studio, build: 3.2.0.201311221859\nSDK build: 3.2.0.v20131122172908\nCLI: 3.2.0-alpha\nAlloy: 1.3.0-alpha6\nXcode: 5.0.2\nDevice: iphone 5 (6.1.3), iphone 5 (7.0.2)\n\nRelated doc tickets:\n\nTIDOC-1382: disabledColor property needs to be documented \nTIDOC-1383: backgroundSelectedImage property is not documented for iOS\nTIDOC-1384: backgroundDisabledImage property is not documented for iOS\n", "updateAuthor": { "name": "wluu", "key": "wluu", "displayName": "Wilson Luu", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2013-11-26T02:43:24.000+0000", "updated": "2013-11-26T02:43:24.000+0000" } ], "maxResults": 21, "total": 21, "startAt": 0 } } }