-1
我使用zBar SDK一旦qr代碼檢測到一個委託將運行,在這個委託內部,我定義了一個myView並將它用作攝像頭上的覆蓋圖,並提供關於該qr代碼的信息。 myView裏有一個調用方法(testAction)的按鈕,但是在這個方法裏我不能訪問我在委託中定義的任何對象,我怎樣才能訪問myView和testAction裏面的對象呢?調用委託內部的方法
- (void) imagePickerController: (UIImagePickerController*) reader
didFinishPickingMediaWithInfo: (NSDictionary*) info
{
UIView *myView;
CGRect frame= CGRectMake(0, 0, 320, 428);
myView=[[UIView alloc] initWithFrame:frame];
myView.backgroundColor=[UIColor greenColor];
myView.alpha=0.7;
CGRect labelFrame = CGRectMake(0, 0, 500, 30);
UILabel* myLabel = [[UILabel alloc] initWithFrame: labelFrame];
[myLabel setTextColor: [UIColor orangeColor]];
NSString *combined = [NSString stringWithFormat:@"%@%@", @"Title: ", symbol.data];
myLabel.text=combined;
UIButton * myButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
myButton.frame = CGRectMake(10, 50, 100, 50);
myButton.tag = 121;
[myButton setTitle:@"Do Something" forState:UIControlStateNormal];
[myButton setBackgroundImage:nil forState:UIControlStateNormal];
[myButton addTarget:self action:@selector(testAction:) forControlEvents:UIControlEventTouchUpInside];
//[button setBackgroundColor:red];
[myView addSubview: myLabel];
[myView addSubview: myButton];
reader.cameraOverlayView=myView;
}
- (void)testAction: (id)sender{
//my issue is here
}
OMG有時大腦只是被鎖定! – user2211254