2011-09-13 16 views
2

iPhoneアプリがiPadで動作するときに問題が発生しました。最初の画面ではカメラオーバーレイビューを使用していますが(アプリ起動時に起動します)、他の画面に移動すると白い空白この上にスペースがあります。これはiPadのみで、iPhoneではすべて素晴らしいです。ここiphoneアプリの問題がipadで実行される

がYES =カメラオーバーレイビューの画像
enter image description here

空白の画面を示すコード

controlView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 320, 480)]; 
controlViewLandscape = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 480, 320)]; 

controlView1= [[UIView alloc]initWithFrame:CGRectMake(0,170, 420, 480)]; 
controlViewLandscape1= [[UIView alloc]initWithFrame:CGRectMake(0, 0, 480, 320)]; 

anImagePickerController = [UIImagePickerController new]; 
anImagePickerController.view.frame=CGRectMake(0, 0, 320, 480); 
anImagePickerController.delegate = self; 
anImagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera; 
anImagePickerController.cameraDevice=UIImagePickerControllerCameraDeviceFront; 
anImagePickerController.showsCameraControls=NO; 
anImagePickerController.wantsFullScreenLayout=YES; 
anImagePickerController.cameraViewTransform=CGAffineTransformScale(anImagePickerController.cameraViewTransform, 1.16676, 1.34299); 



UIButton *startbutton = [UIButton buttonWithType:UIButtonTypeCustom]; 
[startbutton setImage:[UIImage imageNamed:@"play2.png"] forState:UIControlStateNormal]; 
startbutton.frame=CGRectMake(130, 390, 55, 55); 
[startbutton setTitle:@"Start" forState:UIControlStateNormal]; 
[startbutton addTarget:self action:@selector(startChat) forControlEvents:UIControlEventTouchUpInside]; 
anImagePickerController.cameraOverlayView = startbutton; 

UIButton *startbutton1 = [UIButton buttonWithType:UIButtonTypeCustom]; 
startbutton1.frame=CGRectMake(-50, 10, 150, 30); 
[startbutton1 setTitle:@"Status:" forState:UIControlStateNormal]; 
startbutton1.titleLabel.font=[UIFont boldSystemFontOfSize:12]; 


UIButton *startbutton2 = [UIButton buttonWithType:UIButtonTypeCustom]; 
startbutton2.frame=CGRectMake(13, 10, 150, 30); 
[startbutton2 setTitle:@"Disconnected" forState:UIControlStateNormal]; 
startbutton2.titleLabel.font=[UIFont boldSystemFontOfSize:12]; 

//setting button 

UIButton *settingBtn = [UIButton buttonWithType:UIButtonTypeCustom]; 
settingBtn.frame=CGRectMake(272, 10, 43, 43); 
//[settingBtn setTitle:@"Setting" forState:UIControlStateNormal]; 
[settingBtn setImage:[UIImage imageNamed:@"settings.png"] forState:UIControlStateNormal]; 
[settingBtn addTarget:self action:@selector(settingNavigate) forControlEvents:UIControlEventTouchUpInside]; 
[controlView addSubview:settingBtn]; 
[controlView addSubview:startbutton2]; 
[controlView addSubview:startbutton]; 
[controlView addSubview:startbutton1]; 
controlView.tag=10; 
//for landscape 

UIButton *startbuttonl = [UIButton buttonWithType:UIButtonTypeCustom]; 
[startbuttonl setImage:[UIImage imageNamed:@"play2.png"] forState:UIControlStateNormal]; 
startbuttonl.frame=CGRectMake(210, 245, 55, 55); 
[startbuttonl setTitle:@"Start" forState:UIControlStateNormal]; 
[startbuttonl addTarget:self action:@selector(startChat) forControlEvents:UIControlEventTouchUpInside]; 


UIButton *startbutton1l = [UIButton buttonWithType:UIButtonTypeCustom]; 
startbutton1l.frame=CGRectMake(-60,-8, 150, 30); 
[startbutton1l setTitle:@"Status:" forState:UIControlStateNormal]; 
startbutton1l.titleLabel.font=[UIFont boldSystemFontOfSize:12]; 
UIButton *startbutton2l = [UIButton buttonWithType:UIButtonTypeCustom]; 
startbutton2l.frame=CGRectMake(3, -8, 150, 30); 
[startbutton2l setTitle:@"Disconnected" forState:UIControlStateNormal]; 
startbutton2l.titleLabel.font=[UIFont boldSystemFontOfSize:12]; 
//setting button 

UIButton *settingBtnl = [UIButton buttonWithType:UIButtonTypeCustom]; 
settingBtnl.frame=CGRectMake(420,0, 43, 43); 
//[settingBtn setTitle:@"Setting" forState:UIControlStateNormal]; 
[settingBtnl setImage:[UIImage imageNamed:@"settings.png"] forState:UIControlStateNormal]; 
[settingBtnl addTarget:self action:@selector(settingNavigate) forControlEvents:UIControlEventTouchUpInside]; 

[controlViewLandscape addSubview:settingBtnl]; 
[controlViewLandscape addSubview:startbutton2l]; 
[controlViewLandscape addSubview:startbuttonl]; 
[controlViewLandscape addSubview:startbutton1l]; 


//for landscape left 

UIButton *startbuttonlr = [UIButton buttonWithType:UIButtonTypeCustom]; 
[startbuttonlr setImage:[UIImage imageNamed:@"play2.png"] forState:UIControlStateNormal]; 
startbuttonlr.frame=CGRectMake(220, 263, 55, 55); 
[startbuttonlr setTitle:@"Start" forState:UIControlStateNormal]; 
[startbuttonlr addTarget:self action:@selector(startChat) forControlEvents:UIControlEventTouchUpInside]; 


UIButton *startbutton1lr = [UIButton buttonWithType:UIButtonTypeCustom]; 
startbutton1lr.frame=CGRectMake(-40, 20, 150, 30); 
[startbutton1lr setTitle:@"Status:" forState:UIControlStateNormal]; 
startbutton1lr.titleLabel.font=[UIFont boldSystemFontOfSize:12]; 

UIButton *startbutton2lr = [UIButton buttonWithType:UIButtonTypeCustom]; 
startbutton2lr.frame=CGRectMake(23, 20, 150, 30); 
[startbutton2lr setTitle:@"Disconnected" forState:UIControlStateNormal]; 
startbutton2lr.titleLabel.font=[UIFont boldSystemFontOfSize:12]; 

//setting button 

UIButton *settingBtnlr = [UIButton buttonWithType:UIButtonTypeCustom]; 
settingBtnlr.frame=CGRectMake(440, 20, 43, 43); 
//[settingBtn setTitle:@"Setting" forState:UIControlStateNormal]; 
[settingBtnlr setImage:[UIImage imageNamed:@"settings.png"] forState:UIControlStateNormal]; 
[settingBtnlr addTarget:self action:@selector(settingNavigate) forControlEvents:UIControlEventTouchUpInside]; 

[controlViewLandscape1 addSubview:settingBtnlr]; 
[controlViewLandscape1 addSubview:startbutton2lr]; 
[controlViewLandscape1 addSubview:startbuttonlr]; 
[controlViewLandscape1 addSubview:startbutton1lr]; 


//for portrait down 

UIButton *startbuttonlp = [UIButton buttonWithType:UIButtonTypeCustom]; 
[startbuttonlp setImage:[UIImage imageNamed:@"play2.png"] forState:UIControlStateNormal]; 
//startbuttonlp.frame=CGRectMake(-50, 210, 55, 55); 
startbuttonlp.frame=CGRectMake(50, 385, 55, 55); 
[startbuttonlp setTitle:@"Start" forState:UIControlStateNormal]; 
[startbuttonlp addTarget:self action:@selector(startChat) forControlEvents:UIControlEventTouchUpInside]; 


UIButton *startbutton1lp = [UIButton buttonWithType:UIButtonTypeCustom]; 
startbutton1lp.frame=CGRectMake(-130, 0, 150, 30); 
[startbutton1lp setTitle:@"Status:" forState:UIControlStateNormal]; 
startbutton1lp.titleLabel.font=[UIFont boldSystemFontOfSize:12]; 

UIButton *startbutton2lp = [UIButton buttonWithType:UIButtonTypeCustom]; 
startbutton2lp.frame=CGRectMake(-66, 0, 150, 30); 
[startbutton2lp setTitle:@"Disconnected" forState:UIControlStateNormal]; 
startbutton2lp.titleLabel.font=[UIFont boldSystemFontOfSize:12]; 
//setting button 

UIButton *settingBtnlp = [UIButton buttonWithType:UIButtonTypeCustom]; 
settingBtnlp.frame=CGRectMake(192,0, 43, 43); 
// settingBtnlp.frame=CGRectMake(92, 70, 43, 43); 
[settingBtnlp setImage:[UIImage imageNamed:@"settings.png"] forState:UIControlStateNormal]; 
[settingBtnlp addTarget:self action:@selector(settingNavigate) forControlEvents:UIControlEventTouchUpInside]; 

[controlView1 addSubview:settingBtnlp]; 
[controlView1 addSubview:startbutton2lp]; 
[controlView1 addSubview:startbuttonlp]; 
[controlView1 addSubview:startbutton1lp]; 
//to rotate it to landscape 
CGAffineTransform landscapeTransform = CGAffineTransformMakeRotation(degreesToRadian(90)); 
landscapeTransform = CGAffineTransformTranslate(landscapeTransform, +90.0, +90.0); 
[controlViewLandscape setTransform:landscapeTransform]; 

//to rotate it to landscape right 
CGAffineTransform landscapeTransformr = CGAffineTransformMakeRotation(degreesToRadian(-90)); 
landscapeTransformr = CGAffineTransformTranslate(landscapeTransformr, -90, -90); 
[controlViewLandscape1 setTransform:landscapeTransformr]; 
//to rotate it to portrait right 
CGAffineTransform landscapeTransformrp = CGAffineTransformMakeRotation(degreesToRadian(180)); 
landscapeTransformrp = CGAffineTransformTranslate(landscapeTransformrp, +180.0, +180.0); 
[controlView1 setTransform:landscapeTransformrp]; 


controlViewLandscape.tag=20; 
controlViewLandscape1.tag=40; 
controlView1.tag=30; 
//controlView1.hidden=YES; 

// controlViewLandscape.hidden取り付けられています。 // controlViewLandscape1.hidden = YES; // controlView.hidden = YES;

答えて

0

は、ステータスバー

[[UIApplication sharedApplication]setStatusBarHidden:NO]; 

を示し、そして、それは代わりに空白の黒いバーを表示するには、次の行を使用します。私は最初の画面で使用するカメラオーバーレイビューを削除して、単純なビューを使用した場合の協力

0

これはiPadの上部に表示されている状態バーのためであり、iPhoneのその白い場所に存在します。解決

+0

ための誰もが、それはあなたがカメラのオーバーレイからこの最初の画面を追加するにはどうすればよいiPhoneとiPad –

+0

の両方で正常に動作します

感謝view ??そのコード – mayuur

+0

私はカメラにオーバーレイビューを追加するために使用したコードを追加しました。 –

関連する問題