Add vibration and sound settings to local notification in iOS app

I have a UILabel named "Notifiction Sound". In my gestures on the hard drive, I want to open the list of default alerts for the iOS device. When you select any of these warning signals, the selected beep should be set as my local beep. How to implement this?

In addition, I want to add vibration on / off settings for local notification. I have successfully checked if UISwitch vibration is turned on. When the switch is on, I used the following code to set the vibration. Tested this on an iPhone, but it didn’t work. Any idea how to implement it?

And does sound and vibration work together for local notification?

if([[UIDevice currentDevice].model isEqualToString:@"iPhone"])
{
    AudioServicesPlaySystemSound (kSystemSoundID_Vibrate);   
}
else
{
    // Not an iPhone, so doesn't have vibrate
    // play the less annoying tick noise or one of your own
    AudioServicesPlayAlertSound (kSystemSoundID_Vibrate);
}
+4
1

iOS 7.1 , UIActionSheet.

, UIButton : (: )

- (void) actionMethod
{
   UIActionSheet *action = [[UIActionSheet alloc]...];
   // set action delegate

   // the delegate method is where you want to check 
   // what option you want to do and all the other stuff
}

- (void) viewDidLoad
{
   UIButton *b = [UIButton buttonWithType:UIButtonTypeCustom];
   b.frame = ...;
   [b setTitle:@"Notification Sound" ...];
   [b addTarget:self selector:@selector(actionMethod) ...];
   [self.view addSubview:b];
}

. , , . , , Apple

UIActionSheet

0

All Articles