Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7876049
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:06:22+00:00 2026-06-03T03:06:22+00:00

I have a table view it displays data which we select time using the

  • 0

I have a table view it displays data which we select time using the date picker in an action sheet.

in this table view each row having a custom cell ‘ReminderCell’ with a label and an uiswitch button

1.Custom cell
![enter image description here][1]

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    // Note: I set the cell's Identifier property in Interface Builder to DemoTableViewCell.
    ReminderCell *cell = (ReminderCell *)[tableView dequeueReusableCellWithIdentifier:CellClassName];
    if (!cell)
    {
        NSArray *topLevelItems = [cellLoader instantiateWithOwner:self options:nil];
        cell = [topLevelItems objectAtIndex:0];
    }

    //set from action sheet only this row 0
    if( indexPath.row == 0 ) 
    {
        if(date == nil)
        {
            date = [NSDate date];
        }
        NSDateFormatter *timeFormatter = [[NSDateFormatter alloc] init];
        [timeFormatter setDateFormat:@"hh:mm a"];
        cell.label.text = [timeFormatter stringFromDate:date];
    }

When user selects a row an action sheet with a date picker popups

![enter image description here][3]

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{ 

    if(date == nil)
    {
        date = [NSDate date];
    }
    NSDateFormatter *timeFormatter = [[NSDateFormatter alloc] init];
    [timeFormatter setDateFormat:@"hh:mm a"];

    //Add Action sheet
    UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:nil
                                                    delegate:self
                                           cancelButtonTitle:@"Cancel"
                                      destructiveButtonTitle:nil
                                           otherButtonTitles:@"Done",nil];

    // Add date picker to the action sheet
    datePicker = [[UIDatePicker alloc] init];
    datePicker.datePickerMode = UIDatePickerModeTime;
    [actionSheet addSubview:datePicker];
    [actionSheet showInView:self.navigationController.tabBarController.view];        
    [actionSheet setBounds:CGRectMake(0,0,320, 550)];
    [datePicker setFrame:CGRectMake(0, 138, 320, 216)];
    [datePicker release];
    [actionSheet release];
}

Now i need set reminder by select date from this date picker and set on when switch on.
Thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T03:06:23+00:00Added an answer on June 3, 2026 at 3:06 am

    UIKit offers the NSLocalNotification object that is a more high-level abstraction for your task.

        UILocalNotification *yourNotification = [[UILocalNotification alloc] init];
        yourNotification.fireDate = [NSDate date]; // time at which the remainder has to be triggered 
        yourNotification.timeZone = [NSTimeZone defaultTimeZone];
    
        yourNotification.alertBody = @"Notification triggered";
        yourNotification.alertAction = @"Details";
    
    
    /* if you wish to pass additional parameters and arguments, you can fill an info dictionary and set it as userInfo property */
        //NSDictionary *infoDict = //fill it with a reference to an istance of NSDictionary;
        //aNotification.userInfo = infoDict;
    

    in appDelegate.m

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    
    
        UILocalNotification *aNotification = [launchOptions objectForKey: UIApplicationLaunchOptionsLocalNotificationKey]; 
    
        if (aNotification) {
            //if we're here, than we have a local notification. Add the code to display it to the user
        }
    
        [self.window makeKeyAndVisible];
        return YES;
    
    }
    
        - (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
    
                //if we're here, than we have a local notification. Add the code to display it to the user
    
    
        }
    

    To reshudle the alarm

    repeatInterval

    The calendar interval at which to reschedule the notification.

    @property(nonatomic) NSCalendarUnit repeatInterval
    Discussion

    If you assign an calendar unit such as weekly (NSWeekCalendarUnit) or yearly (NSYearCalendarUnit), the system reschedules the notification for delivery at the specified interval. The default value is 0, which means don’t repeat.

    repeatCalendar

    The calendar the system should refer to when it reschedules a repeating notification.

    @property(nonatomic, copy) NSCalendar *repeatCalendar
    Discussion

    The default value is nil, which indicates that the current user calendar is used. (The current user calendar is returned by the currentCalendar class method of NSCalendar.)

    and to schedule a alarm

        UISwitch *onoff = [[UISwitch alloc] initWithFrame: CGRectZero];
        [onoff addTarget: self action: @selector(switchAction:) forControlEvents:UIControlEventValueChanged];
        // Set the desired frame location of onoff here
        [self.view addSubview: onoff];
    
    
    - (IBAction)switchAction:(id)sender {
    
     UISwitch *theSwitch = (UISwitch *)sender;
        UITableViewCell *cell = (UITableViewCell *)theSwitch.superview;
        UITableView *tableView = (UITableView *)cell.superview;
        NSIndexPath *indexPath = [tableView indexPathForCell:cell];
       // From which you can find the index value to get the particular time of the datePicker you set
    if (onoff.on){
         NSLog(@"On");  
        //set the alarm at given time from DatePicker using UILocalNotification 
        }
        else{
          NSLog(@"Off");  
        // cancel the alarm Local Notification here
         }
    }
    

    References

    UILocalNotification Reference

    UILocalNotification Tutorial

    UILocalNotification Programming Guide

    UILocalNotification cancel LocalNotification

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a NSFetchedResultsController which displays data in a UITableView. I'm using the boiler
I have Grouped Table View in which I want to display Contact details. But
I have a search display controller in a table view. In this table view,
I have a table view controller which doesn't let me manually scroll to the
Is this possible? I have a function which creates a table. I want a
I have a simple table which has a some information displayed. To view the
I have a UITableViewController, which is RootViewController. It's XIB only has a table view.
So I have a root view with table view. I display the toolbar like
I have a Table View Controller with cells. I want to update the text
I have a table view controller with custom cells. In those cells i added

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.