가로 및 세로 모두 내용을 표시하는 ipad에 대한 requirnmant가 있습니다. 코드를 완료하고 각 orientations.it에서 제어의 위치를 완료했습니다. 내 코드는아이폰 SDK의 장치 방향
입니다.- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
if (interfaceOrientation == UIInterfaceOrientationLandscapeRight ||interfaceOrientation == UIInterfaceOrientationLandscapeLeft ) {
_viewContainer.frame = CGRectMake(342, 1, 681, 707);
_viewtopic.frame = CGRectMake(1, 62, 343, 56);
_viewpublicspeekingheaderleft.frame = CGRectMake(0, 6, 341, 58);
_viewTableview.frame = CGRectMake(1, 118, 341, 590);
_viewFooter.frame = CGRectMake(1, 716, 1024, 48);
if (interfaceOrientation == UIInterfaceOrientationPortrait ||interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown ) {
_viewContainer.frame = CGRectMake(276, 1, 503, 946);
_viewtopic.frame = CGRectMake(0, 58, 275, 50);
_viewpublicspeekingheaderleft.frame = CGRectMake(0, 1, 275, 58);
_viewTableview.frame = CGRectMake(1, 109, 274, 837);
_viewFooter.frame = CGRectMake(1, 954, 767, 48);
}
return YES;
}
위의 코드는 잘 작동합니다. corect 포지 션의 컨트롤러가 있습니다. 내 probm이 있습니다. 전체 화면을 표시하는 타이머를 설정해야하며 viewcontroller에서 일부 컨트롤을 숨길 필요가 있습니다. , 나는 타이머를 3 초로 설정하고 3 초 후에 일부 컨트롤러를 숨기고보기 컨트롤러에서 othe 컨트롤러를 정렬하여 fce sceen.it도 잘 작동합니다.이 경우에는 me.my 코드가 사용됩니다.
- (void)viewDidLoad
{
[super viewDidLoad];
// Define the timer object
NSTimer *timer;
// Create the timer object
timer = [NSTimer scheduledTimerWithTimeInterval:3.0 target:self
selector:@selector(updateorientation:) userInfo:nil repeats:NO];
}
- (void) updateorientation:(NSTimer *)incomingTimer
{
_tableTopic.hidden =YES;
_viewtopic.hidden =YES;
_viewpublicspeekingheaderleft.hidden =YES;
_viewTableview.hidden =YES;
_imgpulbicspeakingabovethetableview.hidden =YES;
_topiclabel.hidden =YES;
_lblpublicspeekingleft.hidden =YES;
UIInterfaceOrientation orientation =[[UIApplication sharedApplication] statusBarOrientation];
if (orientation == UIDeviceOrientationPortrait || orientation == UIDeviceOrientationPortraitUpsideDown) {
NSLog(@"portrait");// only works after a rotation, not on loading app
_imgMicimage.frame = CGRectMake(69, 130, 635, 216);
_txtContentofTopic.frame = CGRectMake(69, 354, 635, 203);
_viewContainer.frame = CGRectMake(0, 0, 768, 1024);
}
UIInterfaceOrientation orientationLandscape =[[UIApplication sharedApplication] statusBarOrientation];
if (orientationLandscape == UIDeviceOrientationLandscapeLeft || orientationLandscape == UIDeviceOrientationLandscapeRight) {
NSLog(@"landscape");
_imgMicimage.frame = CGRectMake(93, 113, 836, 239);
_txtContentofTopic.frame = CGRectMake(93, 360, 836, 203);
_viewContainer.frame = CGRectMake(0, 0, 1024, 768);
}
}
가 잘 작동하지만 타이머 화재 후, 다음 내가 장치의 방향을 chnage, 난 단지이 문제를 해결하기 위해 function.how - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
쓸만의 arrangmnts이 시간에 arrangmnts 필요 얻을.
미리 감사드립니다.
}
replyis에 대한 감사합니다. 이러한 메소드를 사용할 수 있습니까? 그리고 어떤 코드가이 메서드에 넣을 것입니까? 감사합니다. – stackiphone
작업을 넣었습니다. didRotateFromInterfaceOrientation : 메서드를 호출하고 타이머 메서드의 방향 코드를이 메서드에 넣으면 woks.thanks가됩니다. – stackiphone