действительно ли возможно открыть Settings App с помощью openURL?

Уже существует класс 'text-center' со свойством text-align: center в начальной загрузке. Вы должны использовать это в родительском элементе для выравнивания по центру дочерних элементов.

<div class="container">
  <div class="row">
    <div class="col-md-4 col-md-offset-4 text-center">
      <button class="btn btn-default">Gallery</button>
    </div>
  </div>
</div>
23
задан Flexo 15 October 2011 в 21:10
поделиться

1 ответ

Открытие настроек приложения программно возможно только из iOS 8. Итак, используйте следующий код из http://code-ios.blogspot.in/2014/10/opening-settings-app-from-another- app.html

if([CLLocationManager locationServicesEnabled]&&
   [CLLocationManager authorizationStatus] != kCLAuthorizationStatusDenied)
{
  //...Location service is enabled
}
else
{
    if([[[UIDevice currentDevice] systemVersion] floatValue]<8.0)
    {
    UIAlertView* curr1=[[UIAlertView alloc] initWithTitle:@"This app does not have access to Location service" message:@"You can enable access in Settings->Privacy->Location->Location Services" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
    [curr1 show];
    }
    else
    {
        UIAlertView* curr2=[[UIAlertView alloc] initWithTitle:@"This app does not have access to Location service" message:@"You can enable access in Settings->Privacy->Location->Location Services" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:@"Settings", nil];
        curr2.tag=121;
        [curr2 show];
    }
}

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
 NSLog(@"buttonIndex:%d",buttonIndex);

   if (alertView.tag == 121 && buttonIndex == 1)
 {
  //code for opening settings app in iOS 8
   [[UIApplication sharedApplication] openURL:[NSURL  URLWithString:UIApplicationOpenSettingsURLString]];
 }
}
3
ответ дан 29 November 2019 в 01:30
поделиться
Другие вопросы по тегам:

Похожие вопросы: