I have the following cameraOverlayView
that is working to an extent. When the UIImagePickerController
is called the standard controls are not shown and the 'Take Photo' button and logo.jpg are shown as described in ObViewControllerCameraOverlay. The button functions in that it goes blue when pressed but my problem is that it does not call the action (the NSLog is simply for test purposes). Can anyone see what I might have done wrong?
@implementation ObViewControllerCameraOverlay
- (id)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame])
{
UIImage *logo = [UIImage imageNamed:@"logo.jpg"];
UIImageView *logoView = [[UIImageView alloc] initWithImage:logo];
logoView.frame = CGRectMake(0, 0, 240, 50);
[self addSubview:logoView];
UIButton *takePhotoButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[takePhotoButton setTitle:@"Take photo" forState:UIControlStateNormal];
takePhotoButton.frame = CGRectMake(0, 330, 320, 40);
[self addSubview:takePhotoButton];
}
return self;
}
- (IBAction)takePhotoButton:(id)sender
{
NSLog(@"test");
}
It doesn't look like you've told your button to call
takePhotoButton:
when it's tapped. Try addingafter you've created the button in
initWithFrame: