I have a problem with UIViews to which I really don't know how to proceed.
It will be futile to describe my problem so here are the screenshots of before and after. Somehow the UIView gets the layout that was defined in interfacebuilder AFTER an image is chosen. Before an image is chosen it doesn't obey to its defined layout for some reason.
Before using imagePicker for picking an image:..........................After Picking image:
|So yeah that is basically the problem. The black squares are other images and you can tell by that how it should and how it shouldn't, one of the images is being cut (normally behind the "No SIM" label.) I just put them to hide the real images on the screenshots.
So maybe is something in relation to two things I do here.
- I resize the image chosen to 320-480 and put it on a smaller UIImageView before uploading it to a server.
- If the user is writing on a textField the entire view is animated up, so the keyboard won't hide the textFields.
UPDATE:
I noticed this happens on a UIView that does nothing related to resizing images or textFields. This is happening too on a UIView I have where there are only 3 buttons and 2 labels. Only 5 elements. The 3 buttons are in custom mode with images. So 3 image~Buttons and 2 labels....
Thank you for开发者_运维知识库 your help and suggestions fellow Stackoverflowers!!! (Stackoverflowerers?) I really have no idea on how to proceed here, though I've been playing around transforming the UIView at the viewDidLoad to no avail.
UPDATE 2:
I started to think that maybe there is something wrong with the code I use to make the transition from view to view and has nothing to do with the elements that are contained in it. Since it is happening in all my views EXCEPT the first view. So here is the code I use for the transition of views:
- (void) flipToUploadView {
UploadViewController *aUploadView = [[UploadViewController alloc] initWithNibName:@"UploadView" bundle:nil];
[self setUploadViewController:aUploadView];
[aUploadView release];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:window cache:YES];
[uploadViewController viewWillAppear:YES];
[viewController viewWillDisappear:YES];
[viewController.view removeFromSuperview];
[self.window addSubview:[uploadViewController view]];
[viewController viewDidDisappear:YES];
[uploadViewController viewDidAppear:YES];
[UIView commitAnimations];
}
Sorry don't have enough reputation to comment, but
have both views the same nib?
if not, is it possible that you just forgot to simulate the status bar in InterfaceBuilder for the few which is drawn uncorrect? and thats why the positions are different?
And i think what Tommy means is that normally you use the ModalViewcontroller to change views
[self presentModalViewController:uploadViewController animated:YES];
than all the function calls (willappear,didappear,willdissappear...) are called automatically
but i think this is not the source of the wrong displaying
精彩评论