Send app to background on button tap - objective-c

In my apps there is a button named "Back". When the user clicks on that button, the apps should be sent to the background, like when we click on the home button.

Even if you manage to do this, it is against Apple's HIG (because it will look as a crash to the user) - if you plan to publish your app on the AppStore you'll be rejected.

I think turning to background is impossible.
Make user press home button by using UIAlertView with no cancel button.

We can send an application to the background using SpringBoardUI or the SpringBoardServices private frameworks.
However, Apple won't accept this on the App Store.

Related

How to implement a Facebook like button without leaving iOS app?

I was wondering how can I implement a Facebook "Like" and "Unlike" button right within my app without making the user leave the app. I know Apple has implemented this in their App Store app, so it is clearly possible. Here are some screenshots:
Notice how you can press the like and unlike buttons and you remain in the App Store application. I would like to link these like buttons to my Facebook page.

How to find out style of NSUserNotification during run-time? Or force close an alert?

According to OS X Mountain Lion Release Notes:
"The user has ultimate control over what notifications are displayed, and the style (banner, alert, etc). There is no mechanism to override the user preferences."
Even though all I want to do is "downgrade" from alert style to banner style... Fine. But can I at least find out whether a notification is of alert or banner style inside the didActivateNotification method?
When the alert is a banner (which is what I want), clicking its contents is the only possible action, and this both triggers didActivateNotification method with notification.activationType value of NSUserNotificationActivationTypeContentsClicked and closes the notification banner. I want my app to respond to this action by opening an internet URL.
When the user chooses alert-style notifications, clicking the alert contents also generates didActivateNotification with the same value of notification.activationType, but it stays on screen instead of going away (it only goes away when the Action button is pressed, and notification.activationType has a different value then). I don't want my app to trigger an action repeatedly for the same alert notification, in case the user clicks the content area of an alert notification.
An alternative solution would be to force the alert notification bubble to dismiss when the user clicks its contents. Is this possible?
You can remove the notification with the following:
[[NSUserNotificationCenter defaultUserNotificationCenter] removeDeliveredNotification:notification];

Can I show a UIAlertView as a banner (similar to push notifications) in iOS 5?

I am using a UIAlertView in my code in iOS5, but rather than the classic popup window with an "OK" button to exit, I'd prefer to have my alert show as a banner at the top of the screen that eventually fades away.
Is it possible to change the style of UIAlertView to resemble the iOS 5 push notification banner or does it have to be a popup window that must be dismissed manually? If not, is there any way to use the iOS5 banner notification rather than an alert notification? I don't need to send a push notification but just need to alert the user of something that happens on the server side using the app.
Not using the SDK. You'll have to design and implement that by yourself.
Have a look at:
http://cocoacontrols.com/platforms/ios/controls/mkinfopanel
http://cocoacontrols.com/platforms/ios/controls/jhnotificationmanager

ios5 notifications alert style

Is there any way to set the alert style for notifications via programming in ios5?
My app uses notifications that have actions and I do not want to put those notifications as banners. The flow of the app is dependent on the push notifications that arrive.
So I was finding a way by which I could set the alert style of the notifications to "Alerts" rather than "Banners". Any way to do that?
No, your app cannot control this. It is up to the user to decide how he wants your notifications to display. But why does it bother you? Clicking on the action button (aka "View") or clicking the notification itself in Center is similar in behavior regarding your app's code.

iOS Multitasking App Launch

I developed an app for IPhone and it's posted to itunes for approval. Now when I test the app I found out a strange behavior which I think should be rectified. When I launch app first time, the app launched and when I press home button it closes but when I tap the app icon to open it again it opens where it was last closed.
How can I change the view to first view of the app when it's launched after closing by Home screen button?
If you don't want your app to run in the background you need to set the "Application does not run in background" key in the info.plist file. This means that your app will completely restart every time your user returns to it. Take time to decide if this really is the best move for your app. Allowing users to return to where they left off or remembering information about the last session can be a big plus.
If you do not set the info.plist value like I mention above you can manage the way your app behaves by using the: applicationWillEnterForeground: in UIApplicationDelegate or you could observe UIApplicationWillEnterForegroundNotifications. Read up on all the available notifications and methods available for this in the UIApplication Delegate documentation.