0

im using the followng method , to display image when a timestamp detecetd , am using dispatch_async(dispatch_get_main_queue(), to do UIImageView , its never works its should open a new screen full size image that it ,

 dispatch_async(dispatch_get_main_queue(), ^{ UIImage *myImage = [UIImage imageNamed:@"img.jpg"]; UIImageView *myImageView = [[UIImageView alloc] initWithImage:myImage]; [myImageView setFrame:CGRectMake(0, 0, 100, 200)]; [myImageView release]; ; }); 

my full code

 - (void) onPayload:(PayloadEvent *) event { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; NSString *header = @"[OnPayload] "; if (event.payloadType == TYPE_IDENTIFIED) { if ((event.contentID != -1) && (event.timeStamp == -1)) { [mUI performSelectorOnMainThread: @selector(Trace:) withObject:[NSString stringWithFormat:@"%@ StaticID detected: %x\t\tConfidence: %f\n", header,(int)event.contentID, event.confidence] waitUntilDone:NO]; } if ((event.timeStamp != -1) && (event.contentID == -1)) { [mUI performSelectorOnMainThread: @selector(Trace:) withObject:[NSString stringWithFormat:@"%@ Timestamp detected: %f\t\tConfidence: %f\n", header, event.timeStamp, event.confidence] waitUntilDone:NO]; dispatch_async(dispatch_get_main_queue(), ^{ UIImage *myImage = [UIImage imageNamed:@"img.jpg"]; UIImageView *myImageView = [[UIImageView alloc] initWithImage:myImage]; [myImageView setFrame:CGRectMake(0, 0, 100, 200)]; [myImageView release]; ; }); 
4
  • By the way: this has nothing to do with Xcode at all. Commented May 29, 2013 at 10:35
  • @Marco DonJuan - what type of object did you subclass here? is it a uiviewcontroller? or just a uiview? or something else entirely? Commented May 29, 2013 at 11:13
  • [self.view addSubview:myImageView]; Commented May 29, 2013 at 11:14
  • 1
    @MarcoDonJuan - i dont think you understand me. The class you a re operating in, what is its parent class? In your header file, theres something like '@interface MyClass : Parentclass' of what type is parentclass? Commented May 29, 2013 at 11:21

3 Answers 3

1

You never add myImageView to any view as a subview.

Sign up to request clarification or add additional context in comments.

1 Comment

im getting Property 'View; not found on object of type error after i added it
1

Try to use this one in your code.

[self.view addSubview:myImageView]; 

8 Comments

im getting Property 'View; not found on object of type error after i added sel.view
try to write [self.view addSubview:myImageView]; instead of sel.view
sir, its typo mistake here but in the code its self.view . and sorry for wasting your precious time.!
What problem your are getting.
here is error msg from xcode " Property 'View; not found on object of type ..."
|
1

You are creating an ImageView, assigning an Image to it and releasing the ImageView. In other words, you're not displaying the ImageView anywhere.

If you can't do something like [self.view addSubview:imageView], it means that you're not running this code on a UIViewController subclass.

You basically need to add this ImageView you're creating as a subview for the current view before releasing it.

In which class are you running this code? Do you know which View Controller is currently being displayed?

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.