Add callback to pressing the hold button in iOS [duplicate] - iphone

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Detect when home button is pressed iOS
I need to know when user presses the hold button while using my app and run a method after that. How can I do that?

As per the duplicate I posted, the only events you can respond to (regardless of which button actually triggers the behaviour) are the application lifecycle events;
See the additional explanation here;
Is it possible to distinguish between locking the device and sending an app to background?

Related

when I press the play button I want to play last unlocked level Unity [duplicate]

This question already has answers here:
What is the best way to save game state?
(2 answers)
Closed 5 years ago.
When I open my game I want to press the play button and then play the last level that I've played before I closed my game.
Whenever you load a level, you could use PlayerPrefs to save the name of that scene. Upon loading the game the next time, you can use the LoadScene function of SceneManager to load the scene whose name we stored in PlayerPrefs.

Is adding another clock to the status bar on iPhone possible? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
Is it possible to make either a jailbreak app/tweak or regular app that could display two times on the status bar on iPhone? Is such a thing possible and / or that's already developed?
I have a very special friend in another country and sometimes I forget what time it is there. Having to check the time on the clock app is a pain, especially when talking on the phone. I can't imagine a simple clock could use many system resources.
Is it possible to make either a jailbreak app/tweak or regular app that could display two times on the status bar on iPhone?
Definitely, most likely using MobileSubstrate. What I can imagine as a solution is roughly:
You hook into one of SpringBoard's initialization methods.
You create an UILabel and add it to the status bar as a subview using the addSubview: method.
You spawn a timer (use NSTimer, Grand Central Dispatch or whatever suits you) to update the text of the label every minute or so. You can use NSDate and perhaps NSLocale (I don't have the docs in front of me right now) to find out the local time of another country.
This is is why Apple hasn't already done this. They have way to many icons that can appear up at once. Adding another time would take away precious space for these other icons. When I max out the bar it bumps other icons off, like right now I have music playing but the "Play Button" Icon got bumped off by the "Navigator" Icon.
Check out this site, it shows you most of the icons if they haven't added any more in the iOS 6.
https://sites.google.com/site/appleclubfhs/support/advice-and-articles/understanding-ios-menu-symbols
Your going to have to go with jailbreaking probably or hard programming, because the status bar is basically apart of the iPhone screen.
Best of luck!

Is there a way to lock the background images in UIViewController? [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Interface Builder Lock Item Positions?
Is there a way to lock the background images in UIViewController? I have many buttons in front and is moving all the time? Lets say, just like in Adobe Flash.
In the Identity Inspector (Cmd-Alt-3) there’s a Lock dropdown where you can lock the properties and the view will stop moving.

iPhone application starting problem [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
In my application if im middle of something in my app and i want application should exit(not go in background) when pressing central black round button on iPhone.
Secondly if application is in middle of something and if call comes then it should start from same point.
How can i do that.
If what is you need is your application to start on pressing the Home button on the iPhone, then its not possible. The iPhone has a single button which is used for specific purposes. You cannot override the button action to start your app. And even if you find some ingenious way to do it, Apple are certainly not going to approve it.
In AppDelegate
- (void)applicationDidEnterBackground:(UIApplication *)application {
exit(0);
}
Add UIApplicationExitsOnSuspend in your info.plist
UIApplicationExitsOnSuspend
UIApplicationExitsOnSuspend (Boolean - iOS) specifies that the
application should be terminated rather than moved to the background
when it is quit. Applications linked against iOS SDK 4.0 or later can
include this key and set its value to YES to prevent being
automatically opted-in to background execution and application
suspension. When the value of this key is YES, the application is
terminated and purged from memory instead of moved to the background.
If this key is not present, or is set to NO, the application moves to
the background as usual.
This key is supported in iOS 4.0 and later.
Your questions is not clear at all. If what youre trying to do is load an app according to the status you last closed it (Whether you press the home button or interrupted with a call). Your app will go back to its regular status naturally in iOS 4 after a phone call or if it wasnt closed from the multifunctional bar. However if you want to force your app to start from the beginning on any launch expect from when your coming back from a call the following may help:
you can determine whether a call is incoming while youre app is open using CTCallCenter. see this answer.
Using the delegate method applicationDidEnterBackground: you can check whether a call is incoming or not and then decide whether you want to close your application.
EDIT:
I am not sure this will work as i am not on my computer but give it a try. Insert the following code in the applicationDidEnterBackground method:
CTCallCenter *callCenter = [[CTCallCenter alloc] init];
if ([callCenter.currentCalls count] == 0)
exit(0);
You will need to add the CoreTelephony framework to your project and delegate.h file.
Hope this helps
first one you mentioned was not clear.What you need actually?
The second one can be done by cache the page you last visited and then navigate to or place that page when applicationDidBecomeActive.The applicationDidBecomeActive in appDelegate will execute whenever ypur application become active

How to take a screenshot from the camera view? [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
iOS Capture “screenshot” of camera controller
I'm trying to take a screenshot when the camera of the iphone is running, I want to do this because my goal is to take a lot of screenshot and send them to a server with POST methods to simulate a streaming.
I tried a lot of methods but every time I get a blank image.
I'm french so I'm sorry if my english is bad, and thank you in advance for the help.
add transparant UIView on camera view through overlaying.and then take screenshot from that view.pls check this link