Soru & Cevap

düşey yöne kilitleme özelliğini kontrol etmek ...

23.03.2016 - 09:26

düşey yöne kilitleme özelliğini kontrol etmek için bir kod var mı? Eğer kilit açık ise uygulamaya giriş yapıldığında kilidi kapalı konuma getirecek? Bunu isitoyurm çünkü  

- (UIInterfaceOrientationMask)supportedInterfaceOrientations

{

    return (UIInterfaceOrientationMaskPortrait);

    return (UIInterfaceOrientationMaskLandscapeLeft);

    return (UIInterfaceOrientationMaskLandscapeRight);

    return (UIInterfaceOrientationMaskLandscape);

 

 

}

 

-(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {

    

    return (UIInterfaceOrientationPortrait);

    return (UIInterfaceOrientationLandscapeLeft);

    return (UIInterfaceOrientationLandscapeRight);

 

}

 

 

-(void)metho{

 

 

         UIDeviceOrientation curDeviceOrientation = [[UIDevice currentDevice] orientation];

switch (curDeviceOrientation) {

         

         case UIDeviceOrientationPortrait:

         imageOrientation = UIImageOrientationRightMirrored; //-90

         NSLog(@"sdf");

         //viewImage = [UIImage imageWithCGImage:image.CGImage scale:image.scale orientation:imageOrientation];

      break;

         

         case UIDeviceOrientationLandscapeLeft:

         

         imageOrientation = UIImageOrientationDownMirrored; //180

         viewImage = [UIImage imageWithCGImage:image.CGImage scale:image.scale orientation:imageOrientation];

         

      

         

         

      NSLog(@"left");

         



 yukarıda ki  kodların çalışması için düşey yöne kilitleme seçeneğini kullanıcı kapatmaış olması gerek aksi taktirde kodlarım kullanılamıyor yanı görmuyor orada yaptıgım ayarları.Sanki hiç kod yamamış gibi davranıyor sistem

127 Görüntülenme

1 Cevap

Sitedeki sorulara cevap verebilmek için giriş yapın ya da üye olun.

Profile picture for user coskungun
coskungun
25.03.2016 - 11:49

Merhaba 

Sanırım bu kod işini görecektir. İyi çalışmalar.

 

- (NSUInteger)supportedInterfaceOrientations
{
    NSUInteger returnVal;
    AppDelegate *apppDelegate =  (AppDelegate*)[[UIApplication sharedApplication]delegate];
    NSInteger ekranDurumu =[[[NSUserDefaults standardUserDefaults] objectForKey:@"ekranOri"]integerValue];

    if (apppDelegate.ekranKilitlensinmi == YES)
    {
        if (ekranDurumu == 3 || ekranDurumu == 4)
        {
            returnVal = UIInterfaceOrientationMaskLandscapeRight;
        }else
        {
            returnVal = UIInterfaceOrientationMaskPortrait;
        }
    }else
    {
        returnVal = UIInterfaceOrientationMaskAll;
    }
    return returnVal;
}