iPhone で QR コードを読み取るためにZBar SDKを使用していますが、カメラ/スキャナー ビューの下部に、ユーザー向けの説明テキストであるテキストを追加したいと考えています。これが私がこれまでに持っているものです:
UIView *cameraOverlayView = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
cameraOverlayView.backgroundColor = [UIColor redColor];
UILabel *instructionLabel = [[UILabel alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
[instructionLabel setTextColor:[UIColor grayColor]];
[instructionLabel setBackgroundColor:[UIColor clearColor]];
[instructionLabel setFont:[UIFont fontWithName: @"Trebuchet MS" size: 24.0f]];
[instructionLabel setCenter:cameraOverlayView.center];
[cameraOverlayView addSubview:instructionLabel];
reader.cameraOverlayView = cameraOverlayView;
reader.wantsFullScreenLayout = YES;
[instructionLabel release];
[cameraOverlayView release];
完全なクラスは次のとおりです。
https://gist.github.com/4163761
残念ながら、ラベルは表示されません。ZBar のドキュメントには、この目的で cameraOverlayView を使用するように記載されていますが、機能していないようです。
もう1つ注意してください。私はTitaniumフレームワークを使用しているため、追加のTitaniumクラスはそこからのものですが、私の質問はZBarに固有のものでなければなりません。