iphone-sdk-3.0

iPhone, how do usa an App Delegate variable so it can be used like global variables?

二次信任 提交于 2019-12-06 11:17:15
Heres the code I'm using, see my error afterwards @interface MyAppDelegate : NSObject { NSString *userName; } @property (nonatomic, retain) NSString *userName; ... @end and in the .M file for the App Delegate you would write: @implementation MyAppDelegate @synthesize userName; ... @end Then, whenever you want to fetch or write userName, you would write: MyAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate]; someClass.someString = appDelegate.userName; //..to fetch appDelegate.userName = ..some NSString..; //..to write warning: type 'id ' does not conform to the

How to calculate distance using accelerometer using iphone sdk?

左心房为你撑大大i 提交于 2019-12-06 09:36:57
What is the best way to calculate the distance between two points/Or we can say while we walk calculate distance traveled using accelerometer? My main question is that i'm working on an application in which i need to count distance using two locations but sometimes the core locations fails to update location so at that time how do i calculate the distance traveled? Dave DeLong You can't even get an accurate measurement of velocity from the accelerometer , so you're definitely not going to be able to get an accurate measure of distance traveled. 来源: https://stackoverflow.com/questions/2115288

CoreAudio - how to determine the end of the playing aac file

杀马特。学长 韩版系。学妹 提交于 2019-12-06 08:52:35
I am playing with CoreAudio on the iPhone, and I am unable to find how to know when the song has finished to play. I put a property listener on kAudioQueueProperty_IsRunning , it is working when starting playing but not at the end of the file. It's work when I stop AudioQueue... Do you have an idea ? Thanks a lot. PS : I am using sample code from the excellent book iPhone Cool Projects : http://apress.com/book/downloadfile/4453 Edit : there’s a bug in the code that went out with the book. The fix requires a small modification to -[AudioPlayer audioRequestDidFinish:] so that it calls [queue

How do I change the UITextField so it looks like the Search Text Field?

纵然是瞬间 提交于 2019-12-06 08:43:08
问题 I would like to change the standard iPhone UITextField so that it looks exactly like the search text field within the UISearchBar. You can see an example of this for the SMS text entry field within the iPhone Messages application. I do not believe that the UITextField has a style property that will meet this requirement. Any ideas? 回答1: If you want, you can actually extract the background image from a uisearch bar and make it a stretchable image to use as the background of a UITextField. I

iPhone vertical toggle switch

我们两清 提交于 2019-12-06 08:25:32
问题 I'm trying to create a vertical toggle switch control for the iPhone (along the lines of UISwitch but vertical sliding). I was wondering whether an existing control already existed or if there are any good tutorials that explain the basics of creating custom controls for the iPhone. Currently I've tried using affine transforms to create the vertical switch from a basic UIswitch, and it works except that the slider is too small compared to the slider track, thus I'm looking for information on

Fire a method ever 24 hours

北慕城南 提交于 2019-12-06 08:23:30
I am trying to fire a method once a day at a given time. I've tried a few things but I can't really make it work. any advice would be appreciated. Also, it would be ideal if it would fire regardless of if the app is open or not. Is this possible? UILocalNotification will let you fire a notification (but not a method) when your app is running in the background, or will call a delegate method you implement (application:didReceiveLocalNotification:) if the app is running in the foreground, or will call a method you must implement (application:didFinishLaunchingWithOptions:) when the user responds

UINavigationController back button problem in landscape mode?

这一生的挚爱 提交于 2019-12-06 07:58:19
问题 my iphone application supports portrait mode earlier, now i want to support land scape mode also. everything is working fine in my application except the navigation controller back button. i have used tableviews in navigaton conroller, when i click back button in landscape mode view is getting poped and its loading its previous view but animation is strange. i have given default animation but, in landscape mode view is is animating upside down instead of default left to rite when i click back

Image processing on the iPhone

安稳与你 提交于 2019-12-06 07:21:34
问题 I would like to apply image processing on pictures taken on the iPhone. This processing would involve 2D matrix convolutions etc. I'm afraid that the performance with nested NSArrays would be pretty bad. What is the right way to manipulate pixel based images? Should I simply use C arrays allocated with malloc ? 回答1: Have you looked at the Quartz 2D engine available in the iPhone SDK? Or perhaps Core Graphics? Apple has a nice overview document describing all the different imaging technologies

How to find out if the iPhone is on silent mode?

最后都变了- 提交于 2019-12-06 07:07:03
问题 I have a mailing application. If the user sends a mail successfully, then I need to notify that the mail was sent successfully. For that, I need to know if his phone is on silent mode (in which case there will be a 'vibrate') or regular mode (in which case there will be a 'beep'). Can anyone help me with it? Thanks in advance 回答1: CFStringRef state; UInt32 propertySize = sizeof(CFStringRef); AudioSessionInitialize(NULL, NULL, NULL, NULL); AudioSessionGetProperty(kAudioSessionProperty

Why is app icon white?

本小妞迷上赌 提交于 2019-12-06 06:38:57
Some recent version of iOS caused my app icon to turn white. I've gone through everything in regards to images and can't find the issue. I'm running Xcode 3.2.5 with sdk 4.2. I do have an entry for "Icon files" in Info.plist with 5 keys: Item 0 myapp.png Item 1 myapp@2x.png Item 2 myapp-72.png Item 3 myapp-Small-50.png Item 4 myapp-Small.png Item 5 myapp-Small@2x.png All the above have proper dimensions. I see the image in 'Copy Bundle Resources' and also in the .app file for the simulator version. It is properly reference by name in 'Icon files', Item 0. It is not named Default.png since it