Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-10583] iOS: 'invalid context 0x0' error when setting the 'backgroundRepeat: true' property in a view

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionCannot Reproduce
Resolution Date2013-03-27T08:56:33.000+0000
Affected Version/sRelease 2.1.1
Fix Version/s2013 Sprint 07
ComponentsiOS
Labelsapi
ReporterFederico Casali
AssigneeShameer Jan
Created2012-08-23T16:50:34.000+0000
Updated2017-03-28T17:22:55.000+0000

Description

Problem description

': CGContextDrawTiledImage: invalid context 0x0' error message is displayed in the logs if setting the 'backgroundRepeat: true' property for a view nested inside a tableViewRow.

Sample code

var win = Ti.UI.createWindow({
	backgroundColor:'black'
});

var row = Ti.UI.createTableViewRow({height: 94, className: "standardRow"});
var rightView = Ti.UI.createView({
    backgroundImage: "LightGrayBackground.png",
    width: 205,
    left: 115,
    height: 94,
    top: 0,
    backgroundRepeat: true
});
row.add(rightView);

var tableView = Ti.UI.createTableView({
	backgroundColor:'black',
	data: [row]
});

win.add(tableView);

win.open();
- Run the sample code and check the log. Result: : CGContextDrawTiledImage: invalid context 0x0 is displayed Commenting out the 'backgroundRepeat' property, error is no longer displayed

Attachments

FileDateSize
LightGrayBackground.png2012-08-23T16:50:34.000+00001088
LightGrayBackground@2x.png2012-08-23T16:50:34.000+00001414

Comments

  1. Ivan Skugor 2012-08-27

    This issue happens also if view is not added to table view row. I don't have test case right now, but can make one if necessary.
  2. Seth Benjamin 2012-10-19

    Setting the view/window background to tile after the view has propagated/is visible solves this problem. Possibly delaying the tiling until the view is loaded will be a plausible fix.
  3. Shameer Jan 2013-03-27

    Issue does not reproduces with the release 3.1.0 Tested with Titanium Studio, build: 3.0.1.201212181159 Titanium SDK version: 3.1.0 iOS iPhone Simulator: iOS SDK version: 6.0
  4. Danny Pham 2013-04-07

    Issue still exists, tested with SDK 3.0.2. Workaround with using "postlayout" event can be found here: [http://developer.appcelerator.com/question/147793/error---cgcontextdrawtiledimage-invalid-context-0x0] Would be nice if problem could be solved without workaround.
  5. Lee Morris 2017-03-28

    Can verify this ticket as "Cannot Reproduce". The error no longer shows up in the console log in Studio. Tested with the following environment; iPhone 7 (10.2) MacOS 10.11.6 (15G31) Studio 4.8.1.201612050850 Ti SDK 6.0.3 GA Appc NPM 4.2.8 Appc CLI 6.1.0 Ti CLI 5.0.11 Alloy 1.9.5 Arrow 1.10.1 Xcode 8.2 (8C38) Node v4.6.0 Java 1.7.0_80

JSON Source