Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-3424] iOS: Label with backgroundImage Error

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2014-01-28T23:59:40.000+0000
Affected Version/sn/a
Fix Version/sRelease 3.2.0
ComponentsiOS
Labelsmodule_label, qe-closed-3.2.2, qe-testadded, supportTeam
ReporterAlan Leard
AssigneeIngo Muschenetz
Created2011-04-15T03:45:01.000+0000
Updated2014-03-13T10:24:36.000+0000

Description

Problem

Error message shows in Ti Console when using a backgroundImage on a label.

Error Message:

<Error>: CGContextConcatCTM: invalid context 0x0
<Error>: CGContextSetInterpolationQuality: invalid context 0x0
<Error>: CGContextDrawImage: invalid context 0x0
<Error>: CGBitmapContextCreateImage: invalid context 0x0

Test Code

var window = Titanium.UI.createWindow({  
    title:'LabelImageTest',
    backgroundColor:'#fff'
});

var label = Titanium.UI.createLabel({
    backgroundImage: 'default_app_logo.png',
    text: 'This is a label with a backgroundImage'
});
window.add(label);
window.open();

Ticket Reference

http://developer.appcelerator.com/helpdesk/view/76638

Comments

  1. Gerry Cardinal III 2011-04-22

    I fixed it by commenting out the code that wasn't doing anything anyway: -(void)setBackgroundImage_:(id)url { if (url != nil) { // !!!: this doesn't work because self.frame.size isn't set // UIImage* bgImage = [UIImageResize resizedImage:self.frame.size // interpolationQuality:kCGInterpolationDefault // image:[self loadImage:url] // hires:NO]; // Resizing doesn't preserve stretchability. Should we maybe fix this? UIImage* bgImage = [self loadImage:url]; if (backgroundView == nil) { backgroundView = [[UIImageView alloc] initWithImage:bgImage]; backgroundView.userInteractionEnabled = NO; [self insertSubview:backgroundView atIndex:0]; repad = YES; [self padLabel]; } else { backgroundView.image = bgImage; [backgroundView setNeedsDisplay]; repad = YES; [self padLabel]; } } else { if (backgroundView) { [backgroundView removeFromSuperview]; RELEASE_TO_NIL(backgroundView); } } self.backgroundImage = url; }
  2. Jon Alter 2011-08-05

    Associated Helpdesk Ticket

    http://appc.me/c/APP-593963
  3. Roel kramer 2011-08-26

    Got this problem as well! Will find another workaround.
  4. Junaid Younus 2012-05-16

    Tested with 2.0.1GA2 on a HTC Sensation 4G, unable to reproduce this issue. Ticket closed.
  5. Neeraj Gupta 2012-05-16

    This issue was filed for iOS platform so it needs to be verified against the same platform.
  6. Shak Hossain 2014-01-28

    Resolving this since we can't reproduce it with 3.2GA
  7. Neha Mittal 2014-03-10

    Verified as fixed using below environment so closing the issue: Environment: Appc Studio: 3.2.2.201402280732 Sdk: 3.2.2.v20140221161255 acs: 1.0.14 npm: 1.3.2 alloy:1.3.1 titanium:3.2.1 titanium-code-processor:1.1.0 Xcode: 5.1-beta5 Osx: Maverick(10.9.2) Device: iPhone 5S (iOS 7.1)

JSON Source