Iphone iOS:[imagePickerController.cameraOverlayView添加子视图:]不工作
我正在尝试为自定义imagePickerController向cameraOverlayView添加UIToolbar。这是我要使用的代码:Iphone iOS:[imagePickerController.cameraOverlayView添加子视图:]不工作,iphone,ios,ios5,ios4,uiimagepickercontroller,Iphone,Ios,Ios5,Ios4,Uiimagepickercontroller,我正在尝试为自定义imagePickerController向cameraOverlayView添加UIToolbar。这是我要使用的代码: [self.imagePickerController.cameraOverlayView addSubview:self.topToolbar]; 尝试添加UIToolbar时,没有显示任何内容。将其封装到UIView中并将其设置为view属性,如果我使用: [self.imagePickerController.cameraOverlayView a
[self.imagePickerController.cameraOverlayView addSubview:self.topToolbar];
尝试添加UIToolbar时,没有显示任何内容。将其封装到UIView中并将其设置为view属性,如果我使用:
[self.imagePickerController.cameraOverlayView addSubview:self.view];
但这限制了我在添加多个视图时只能使用一个视图进行覆盖。我知道我可以将所有内容封装到一个大视图中,但是当我这样做时,我的底部工具栏无法正确显示
是否有人成功地将UIToolbar作为子视图添加到cameraOverlayView中?我认为您需要一个视图来将所有需要的内容放入cameraOverlay中。 例如: TempView=[[UIView alloc]initWithFrame:CGRectMake(0,0320480)]; TempView.alpha=1.0
anImageView1 = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@""]];
anImageView1.frame = CGRectMake(0, 0, anImageView1.image.size.width, anImageView1.image.size.height-50);
anImageView1.hidden = NO;
anImageView1.alpha = 1.0f;
tabBarHolder = [[UIImageView alloc]init];
tabBarHolder.backgroundColor = [UIColor blackColor];
tabBarHolder.frame = CGRectMake(0, 415, 320, 80);
tampBtn = [[UIButton alloc] initWithFrame:CGRectMake(15, 430, 35, 35)];
[tampBtn setBackgroundImage:[UIImage imageNamed:@"iconBack.png"] forState:UIControlStateNormal];
[tampBtn addTarget:self
action:@selector(xup)
forControlEvents:UIControlEventTouchUpInside];
ctampBtn = [[UIButton alloc] initWithFrame:CGRectMake(145, 430, 35, 35)];
[ctampBtn setBackgroundImage:[UIImage imageNamed:@"iconCamera.png"] forState:UIControlStateNormal];
[ctampBtn addTarget:self
action:@selector(takephoto)
forControlEvents:UIControlEventTouchUpInside];
[TempView addSubview:ctampBtn];
[TempView addSubview:tampBtn];
[TempView addSubview:anImageView1];
[TempView addSubview:tabBarHolder];
[TempView bringSubviewToFront:tabBarHolder];
[TempView bringSubviewToFront: ctampBtn];
[TempView bringSubviewToFront:tampBtn];
imagePicker.cameraOverlayView =TempView;
[self.imagePickerController.cameraOverlayView添加子视图:self.topToolbar];对我来说很好。我想我们需要更多的细节。你是如何初始化你的工具栏的?对,但比如说我只想要一个工具栏。UIToolbar是UIView的一个子类。单独添加工具栏不应该起作用吗?