How Do I Register for a Local Notification?

Discussion in 'iOS Programming' started by kaydell.leavitt, Apr 20, 2010.

  1. kaydell.leavitt macrumors regular

    Joined:
    Apr 19, 2010
    #1
  2. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #2
    There is sample code in that link. What are you having trouble with?
     
  3. kaydell.leavitt thread starter macrumors regular

    Joined:
    Apr 19, 2010
    #3
    I was hoping to see the code in context.

    I have this code to register to receive the notifications that I'm interested in:

    Code:
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(cancelKeyboard:) name:UIKeyboardWillShowNotification object:nil];
    
    And I have the following code to handle my observing the notifications:

    Code:
    - (void) cancelKeyboard: (NSNotification *) notification
    {
    	UITextField *theTextField = [notification object];
    	[theTextField resignFirstResponder];
    }
    
    My idea is that when the user touches a text field to enter the cursor there and to enter numbers that my buttons can be used instead of the keyboard. This is necessary as discussed in the following thread:
    [link]
    http://forums.macrumors.com/showthread.php?t=900959
    [link/]

    -- Kaydell
     
  4. fishkorp macrumors 68020

    fishkorp

    Joined:
    Apr 10, 2006
    Location:
    Ellicott City, MD
    #4
    *edit*
    My bad, I thought you were talking about the 4.0 Local Notifications. Disregard.
     
  5. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #5
    kaydell.leavitt, if you're not sure how to use that code I suggest stepping back and learning Objective-C in more detail.
     
  6. kaydell.leavitt thread starter macrumors regular

    Joined:
    Apr 19, 2010
  7. StevenHu macrumors member

    Joined:
    Sep 3, 2009
    Location:
    Southern CA
    #7
    That site's not too bad, but there are few replies, unfortunately.
     
  8. StevenHu macrumors member

    Joined:
    Sep 3, 2009
    Location:
    Southern CA
    #8
    How do you know when to give that answer and when to give more help? For instance, if I look up the index in Programming in Objective-C 2.0, by Stephen G. Kochan, there's no mention of notifications.

    I say this as someone who has been working on iPhone projects for almost a year. It seems there's always something new to learn, and every new thing has to start somewhere.

    Thanks,
    Steve
     
  9. kaydell.leavitt thread starter macrumors regular

    Joined:
    Apr 19, 2010
    #9

Share This Page