Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

schenker

macrumors newbie
Original poster
Jul 14, 2011
19
0
Hi, I created a convenience method in a class by itself to display an image on screen. I tested it with my mainViewController, but for some reason it didnt show the image on screen. I simplified the convenience method, see .m file below.

Code:
#import "Transition.h"


@implementation Transition



-(void)showSomething
{
    
    UIImageView *tempoView=[[UIImageView alloc]initWithFrame:CGRectMake(40, 40, 50, 50)];
    tempoView.image=[UIImage imageNamed:@"unlocked4.png"];
    [self.view addSubview:tempoView];
    [tempoView release]; 

}


@end

Do you have any idea why the image isnt showing up? Thanks.
 
Image View

As far as I can tell, you're code for creating the imageView and adding it to your view is fine. Are you sure this method is being called? And is the name of the image you're using spelled correctly? If it isn't the imageView won't show up.
 
Yes, no problem with the method being called, 'cos i've already tested it with nslog.
File name is correct too, 'cos i actually copied and pasted from another class that uses this image.

My guess is, could it be anything to do with the views?

//this problem has ruined my appetite :(

Thanks for your reply.
 
YES! Got it done!

The problem is the view. What i did was, got the current view and passed it to my method in transition.m file. That fixed it.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.