我使用followng方法,在检测到时间戳时显示图像,我正在使用dispatch_async(dispatch_get_main_queue(),做UIImageView,它永远不会工作它应该打开一个新的屏幕全尺寸图像,
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];
;
});
我的完整代码
- (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];
; });