I have implemented UILocalNotification. Everything is working fine and i can see the Notification also. I can see the notification and it shows me two button "cancel" and "View" from which i do not want "view" button can i do this?
How to do this?
Hi sorry for late reply you can Have only Ok button for UilocalNotifications
by doing this
notif.hasAction=NO;
by doing this you cannot see view button in the notifications Hope it solved your Problem
No. you can not do this. because local notification generated from ios u only change the name of view button by alertAction property.
i think its not possible to show one button in nslocal notification
notification.alertAction = NSLocalizedString(#"hello", nil); // its set instead of view to hello.
notification.alertAction = NSLocalizedString(nil, nil); // default view Name is coming For action Button to application
Related
How to set action for UILocalNotification "CLOSE" action? If the user click the "CLOSE" button, at the time I will stop the audio player. Is it possible to do this?
I need some suggestions about this feature.
Please help me. Thanks in advance.
You can't detect the close or view button on an UILocalNotification because the notification is handled by iOS and not your app.
If the user decides to view the notification, your app will be started or brought to the foreground and then your app will receive the notification that the user used to open the app.
No, it is not possible to do this. We don't get any event for this.
Yes it is possible you need to create on delegate method and in that method you need to stop your audio player or else when you are calling close button action at that time you need to stop your audio player.
I want Button action done automatically when a view load. Is it possible?
The other answers are correct in that setting the action that your button is tied to, then in your viewDidLoad:, call that function will work. I will just chime in with another method for others info.
You can send it a control event telling it that the button should act as if it has been pressed:
[button sendActionsForControlEvents:UIControlEventTouchUpInside];
This is useful when you do not have an outlet to the button. For instance, I created an app where the user can press on a web view and launch a youtube video. It was also required that if the user presses a "video" button, then the same youtube video would launch. Basically, I had to fire a press event on the web view. So i searched through its views and found the button, from there I called the above line, and the webview pushes a video view controller for the youtube video.
Certainly Yes. Call your method as
assuming your method declaration as
-(IBAction)yourButtonTapEvent:(id)sender;
[self yourButtonTapEvent:nil];
Yes, in your viewDidAppear method, just call the action you are providing for that specific button.
- (void)viewDidAppear:(BOOL)animated
{
[self yourButtonAction:nil];
[super viewDidAppear:animated];
}
I put an in app purchase into my app, and when the user taps a button, the purchase is started. So basically, they tap the button, and then depending on the speed on their Internet connection, they could be waiting for up to ten seconds until a new alert view comes up asking if they would like to buy the product. The user will probably tap the button multiple times since nothing came up, and then multiple purchase alert views will come up. Additionally, this could maybe be seen by the user as an app bug. In the end, this is a problem.
I want an alert view to come up with a spinning wheel that says "Loading..." when the users taps the buy button. Now my problem is, how do I get that to dismiss when the new alert view comes up asking the user if they want to buy the product?
if ([UIAlertView alloc] that says: #"whatever Apple's alert view says")
{
//dismiss the "Loading..." alert view here
}
I doubt that would work, so any input is appreciated. Thanks!
You need to have access to that alertview. You can do this. Create a alertview instance var in app delegate and when you want to show loading initialize that instance var assign to your property and when you want to dismiss just call
[alertViewinstance dismissWithClickedButtonAtIndex:0];
Write this piece of code in a method in appDelegate. Hope you get the idea. If not let me know I'll post the sample code here.
Could anyone please tell me how to handle push notification dialog's view and close button click from my application? I have gone through this thread which says to handle it in ViewDidLoad but when I click View button, this method doesn't get invoked. I want to do take user to some particular view on View button click and record the Close button click on my Server. So basically I want to know what happens when this button(s) clicked? I have gone through Apple docs but it nothing say about these actions. Any documentation and/or code sample would be really greatful.
Thanks.
If user clicks view then you can catch that action in didFinishLaunchWithOptions method of AppDelegate class. If user clicks close then, there is no way for application to catch that. If your application didn't get the notification in AppDelegate class, then either you forgot to register your app for push notification or you didn't send push notification properly to APNS.
I need to know the state of the button at this time if clicked or not ?
thanks
if (myButton.state & UIControlStateHighlighted) {
// Do your stuff the user is currently holding down her finger…
}
take a look at the state property of your UIButton. You're interested in UIControlStateHighlighted.