TUIImage imageName could not accept image name without extention #131

slavikshen opened this Issue Jan 24, 2013 · 0 comments


None yet
1 participant

The imageName method in TUIImage could not accept the image name without ext.
The NSImage or UIImage could auto complete the image name with png and @2x according to the environment.

I suggest the following change. It works well for me.

+ (TUIImage *)imageNamed:(NSString *)name cache:(BOOL)shouldCache
        return nil;

    static NSMutableDictionary *cache = nil;
    if(!cache) {
        cache = [[NSMutableDictionary alloc] init];

    TUIImage *image = [cache objectForKey:name];
        return image;

    NSImage* nsImage = [NSImage imageNamed:name];
        return nil;

    NSData* data = [nsImage TIFFRepresentation];
    if(data) {
        image = [self imageWithData:data];
        if(image) {
            if(shouldCache) {
                [cache setObject:image forKey:name];

    return image;

mralexgray referenced this issue in mralexgray/twui Apr 2, 2013

Merge pull request #131 from github/tracking-view-memory-management
Fix TUINSView trackingView memory management
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment