I have a cell in a table view which has a button for scheduling notifications. Is it possible to delete or cancel a notification for that particular cell without affecting the notifications scheduled by other cells ? I want to delete or cancel the particular notification using the same button. If so, please help me with a sample swift code.
@IBAction func setNotification(sender: UIButton!) {
cell = tableView.cellForRowAtIndexPath(NSIndexPath(forRow: sender.tag, inSection: 0)) as! CustomTableViewCell
if sender.selected {
sender.selected = false
}else {
currentRegion = CLCircularRegion(center: CLLocationCoordinate2D(latitude: latitude ,longitude:longitude), radius: radius, identifier: identifier)
regionMonitor()
manager.stopUpdatingLocation()
sender.selected = true } }
code for didEnterRegion()
func locationManager(manager: CLLocationManager!, didEnterRegion region: CLRegion!) {
localNotification.regionTriggersOnce = true
localNotification.alertBody = "you have reached"
UIApplication.sharedApplication().scheduleLocalNotification(localNotification)
NSLog("Entering region") }
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire