जब मैं ओरिएंटेशन बदलता हूं तो मेरा टेक्स्टव्यू अनुचित रूप से बदलता है, सीमाएं दाएं या बाएं या नीचे या ऊपर कूदती हैं ... यहां मेरा कोड है, कृपया मेरी मदद करें .... मैं अपने पूर्ण टेक्स्ट UIView का आकार कैसे बदल सकता हूं .. धन्यवादअभिविन्यास बदलते समय UIView का सही आकार कैसे बदलें?
- (void)viewDidLoad
{ frameHor=CGRectMake(0,10,275,306);
frameVer=CGRectMake(0, 51, 320, 351);
..
}
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{
[super willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];
if(toInterfaceOrientation == UIInterfaceOrientationPortrait || toInterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown){
//self.view = portraitView;
[self changeTheViewToPortrait:YES andDuration:duration];
}
else if(toInterfaceOrientation == UIInterfaceOrientationLandscapeRight || toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft){
//self.view = landscapeView;
[self changeTheViewToPortrait:NO andDuration:duration];
}
}
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------
- (void) changeTheViewToPortrait:(BOOL)portrait andDuration:(NSTimeInterval)duration {
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:duration];
if(portrait){
self.titleLabel.hidden=NO;
self.backButton.hidden=NO;
[self.view setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"det.png"]]];
self.fullText.frame=CGRectMake(frameVer.origin.x, frameVer.origin.y, frameVer.size.width, frameVer.size.height);
}
else{
self.titleLabel.hidden=YES;
self.backButton.hidden=YES;
self.fullText.frame=CGRectMake(frameHor.origin.x, frameHor.origin.y, frameHor.size.width, frameHor.size.height);
[self.view setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"T_iphoneauto.png"]]];
}
[UIView commitAnimations];
}
हाँ, धन्यवाद, मैं autoresizingMask चाल समझते हैं लेकिन लैंडस्केप में मैं कुछ विचारों को छिपाने और ऊपर TextView लिफ्ट चाहिए ... अगर मैं कुछ भी बेहतर नहीं मिल रहा है जब, मैं AutoResizingMask –
पर रुक जाएगा आप अपने केंद्र की संपत्ति को बदल सकते हैं या फ्रेम बदल सकते हैं, जब आपके पास कोई अन्य दृश्य मोड हो। – Nekto