Quote:
Originally Posted by DenVog
I've been doing pretty much everything I can in IB, so I guess I'll have to learn something new on top of the new thing I'm already trying to learn.
I found a couple different ways to add an image on top of the picker. Not sure if one is more correct or efficient than the other.
Code:
UIImageView *cameraOverlay = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"overlay-image.png"]];
[picker.view sendSubviewToBack:cameraOverlay];
[cameraOverlay release];
This one does allow precise positioning of the image:
Code:
// x-coordinate, y-coordinate, width, height
CGRect cameraOverlayRect = CGRectMake(160,240,47,47);
UIImageView *cameraOverlay = [[UIImageView alloc] initWithFrame:cameraOverlayRect];
[cameraOverlay setImage:[UIImage imageNamed:@"overlay-image.png"]];
// supposed to enhance performance by explicitly stating opaque
cameraOverlay.opaque = YES;
[picker.view addSubview:cameraOverlay];
// Tells it to bring the subview to top of view layers, but don't think it's needed
[picker.view bringSubviewToFront:cameraOverlay];
[cameraOverlay release];
Now on to step 2. Any examples or pointers are appreciated.
|
First of all, this code helped me a lot understanding what I want to thank you.
I wonder if u guys can give me a hint to modify this sample code for my app needs.
Instead of assigning directly an image in addition to the camera I want to add programatically and image from an existing imageView. Is that clear enough to understand my point ?
It's in this line I guess I need to change something : initWithImage:[UIImage imageNamed:@"overlay-image.png"]];