Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-28335] iOS: Button Image renders blue shape, not actual image

GitHub Issuen/a
TypeBug
PriorityCritical
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 9.2.2, Release 9.3.1
Fix Version/sn/a
ComponentsiOS
Labelsn/a
ReporterRene Pot
AssigneeVijay Singh
Created2021-02-04T11:01:03.000+0000
Updated2021-02-17T21:08:06.000+0000

Description

On iOS, when setting the image property on a Ti.UI.Button the image itself is not actually displayed, but instead, a blue shape is rendered instead (see attachment). The blue shape is shaped the way the image is, but there is no way to actually get the image to display properly. *Expected result* The image should display as expected *Example code*
<Alloy>
    <Window>
        <View id="myIcon">
            <Label>Oo</Label>
        </View>
        <Button id="Awesome" />
    </Window>
</Alloy>
$.getView().open();

setTimeout(() => {
    let blob = $.myIcon.toImage();
    $.Awesome.image = blob;
}, 1000);
"Window": {
	backgroundColor: "#fff"
}


"#Awesome": {
	title: "Awesome",
	height: 50,
	width: 200,
	borderWidth: 1,
	borderRadius: 10,
	borderColor: "#333",
	color: "#333"
}

"#myIcon": {
	height: 30,
	width: 30,
	backgroundColor: "green",
	top: 100,
	borderRadius: 6
}

"Label": {
	font: {
		fontSize: 12
	},
	top: 3
}

Attachments

FileDateSize
Simulator Screen Shot - iPhone 11 - 2021-02-04 at 10.56.42.png2021-02-04T11:00:06.000+000045359
TestImageOnButton.zip2021-02-17T21:04:35.000+000041511

Comments

  1. Vijay Singh 2021-02-05

    [~topener] Can you confirm if the issue is with toImage() function or while assigning image to Button?
  2. Rene Pot 2021-02-05

    [~vijaysingh] the problem is with any image applied to the button, I just used toImage() to be able to reproduce the problem without having to supply an image in the sample.
  3. Vijay Singh 2021-02-17

    In native implementation also it is behaving in same way. It is showing blue image. See [^TestImageOnButton.zip] . It looks like apple bug. May be you want to use property [backgroundImage](https://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.Button-property-backgroundImage).

JSON Source