I know there are some questions about UIImageView full-size have been asked but I'm still stuck with my problems.
I have a navigation bar, a scrollview, a UIImageView (named avatarTest) and a button. When I press the image, the UIImageView expand to full-size (320*480) and set the avatarTest.contentMode is ModeCenter.
My problems are:
UIImageView expanded to 320*480 but it didn't replace the navigation bar and status bar (like picture 1 and 2)
When I scroll down (now my button appear) and I press image, the UIImageView still expand according the old view. I want it expand to the full size, fill my current view (window) (like picture 3 and 4)
I want to know how to determine the origin frame (CGRectMake) of UIImageView by code so I can code for the 2nd press action (resize the image to origin)
Here are some my viewController.m codes:
- (IBAction) expand {
[UIView animateWithDuration:0.5f animations:^{
CGRect screenRect = [[UIScreen mainScreen] bounds];
CGFloat screenWidth = screenRect.size.width;
CGFloat screenHeight = screenRect.size.height;
avatarTest.frame=CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y, screenWidth, screenHeight);
avatarTest.contentMode=UIViewContentModeCenter;
avatarTest.backgroundColor = [UIColor blackColor];
}];
}