textview get overide by image from gallery
I am trying to place text view on image view of particular size, but when i load the image from photo gallery my text view get over written and I am not able to write upon it . I guess, when I create a rectangle frame for bi then image from gallery get override to text view. what should I do?
answer: this is working ocde:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { // set image emailImage1 = [info objectForKey:UIImagePickerControllerOriginalImage]; //bi.image = [info objectForKey:UIImagePickerControllerOriginalImage]; image = [info objectForKey:UIImagePickerControllerOriginalImage]; bi = [[UIImageView alloc ] initWithImage: image ]; bi.frame = CGRectMake(20.0f, 100.0f,260.0f, 285.0f); [self.view addSubview: bi]; [self.view bringSubviewToFront:scroll]; [[picker parentViewController] dismissModalViewControllerAnimated:YES]; [picker release]; } - (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker 开发者_运维技巧 { // release picker [[picker parentViewController] dismissModalViewControllerAnimated:YES]; [picker release]; }
help plz
Hey There,
There's onyl one line which causes the problem. You add the bi
as a subview like this:
[self.view addSubview: bi ];
That's correct. But look at this from the domentation of UIView:
After being added, this view appears on top of any other subviews.
Try the following instead
[self.view insertSubview: bi belowSubview: YourTextView];
Replace 'YourTextView' with a pointer to your textview. Than it should work.
Sandro Meier
syntax was [self.view bringSubviewToFront:yourTextView];
精彩评论