ios

Disable Bluetooth hardware programmatically in iOS?

How can I turn off the bluetooth hardware when I'm done with it so that my app does not drain the battery? I've seen references to private frameworks but not how to do this in a way that will not get rejected by Apple. What Framework/code do I need? ...

What are your CoreLocation best practices?

I am working on a CoreLocation based application wich should show the position of the user on a map. My current problem is, that the precision of CL is not very good. I am testing the app in an urban environment, so i am walking through a the streets around our office and see how precise it is. The horizontalAccuracy is usually around ...

Properly displaying and dismissing fullscreen MPMoviePlayerController in iOS 3.2 (iPad)

I'm having lots of trouble displaying a fullscreen movie in my iPad app and then allowing the user to dismiss it with either the Done button or the "un-fullscreen" button on the player controls. Initially I was using MPMoviePlayerViewController for the movie presentation, but I wasn't receiving the enter/exit fullscreen notifications fr...

DB to run on OS X server that will sync nicely with Core Data on iOS?

I am trying to plan out a few iOS/server apps for internal use. On the iOS side I'll use Core Data, but I'm not so sure what many people do on the server side. I will be running a Mac Mini with OS X Server 10.6.X. This app will need to sync when the iOS device is on the internal WiFi as well as over 3G. Some of this data will need to be ...

MKMapView changes physical position in the view

I've put an MKMapView in a view at certain x-y coordinates (x:25 y:120) at a size that's about a third of the view tall and fills much of the width (w:275, h:150). There are other elements in the view, mostly labels and buttons. When looking at it after having it appear [edited to add: while running the app in the simulator] (pushed ont...

How to get proper UIInterfaceOrientation from a nested UIViewController

When I place a view controller's view inside a top level view controller, the UIInterfaceOrientation I get from the nested view controller is incorrect. If I get the orientation from the top level view controller, I get the correct one. The interfaceOrientation property is readonly, so I can't simply set it. How can I get my nested view ...

Marking an MPMediaItem (podcast) as listened to

Is there a way to update the 'listened to' status of an MPMediaItem from the iPod library? I've tried using MPMusicPlayerController in iPodMusicPlayer mode and it does not mark the podcast as listened to once it finishes playing. ...

CTFont and CoreText framework

I'm trying to use CTFont in an iPhone app. I have :- Added the CoreText framework Added #import "CoreText/CoreText." to the file I am trying to use CTFont in. However the compiler is saying that "CTFont undeclared" ??? what am I missing? ...

Easiest Fix for iOS 4's TableView cell deletion error

The title kinda asks for it all. The function: - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { if (editingStyle == UITableViewCellEditingStyleDelete) { // Delete the row from the data source. [tableView deleteRowsAtI...

Programmatically selecting text in an input field on iOS devices (mobile Safari)

How do you programmatically select the text of an input field on iOS devices, e.g. iPhone, iPad running mobile Safari? Normally it is sufficient to call the .select() function on the <input ... /> element, but this does not work on those devices. The cursor is simply left at the end of the existing entry with no selection made. ...

Proper way to Add a TableView to an iOS project's view Hierarchy?

We have a simple view based application we're building for the iPad. We're doing a custom UI so everything is being done programmatically. At the moment our view heirarchy looks something like this: UIViewController -> UITableViewController -> TableView We want to transition to the UITableViewController's TableView when an event fires....

Focus on Blur Substitutes for Touch Events on iOS4?

My Desktop Webkit enabled App uses the following: iframe.contentDocument.defaultView.addEventListener("focus", function(event) { toolbar.show() }, false); iframe.contentDocument.defaultView.addEventListener("blur", function(event) { toolbar.hide() }, false); Is there a way to update this to support Touch Events on the iOS Safari Brows...

Is there any downside to using __weak in iOS Objective-C code?

I'm writing iOS Objective-C code. I prefer __weak MyClass *myWeakIVar; to, e.g. MyClass *myWeakIvar; // weak Not only does it read better to me, but if I ever use this code on a garbage-collected platform, I get the benefits of the __weak directive. Are there any downsides to this? Put another way, is it presently equivalent to a n...

Performance - structs in NSValue vs container object

In a situation where I need to save all data members in a NSDictionary, does it make more sense to put structs (custom types, or even scalars i.e. CGPoint) in my own wrapper (not NSValue), so I can avoid the overhead of encoding/decoding it every time I get or set the member? For large structs (16 floats) the savings is IMO significant....

Easiest way to prevent the cursor from going behind the keyboard in iPhone SDK?

Hi. I have a table with several text fields in it. Tapping on any of the text fields brings up the keyboard and the view scrolls automatically to bring the cursor above the keyboard if required. I have a method in there that gets called whenever the user presses the Return key while editing a text field and I simply move the first resp...

Universal app design 1 table view that opens different view on cell click depending if on iPad or iPhone

I'm making a universal app and I've run across a situation I'm stumped on. On the iPad I'm using a split view, and I would like to make a UITableViewController that is shared on both the iPad and iPhone. I did that, but now when the user clicks a table cell I need to respond. On the iPhone I will init a new view controller and push it in...

iOS SDK 4.0 & 4.1 add images to simulator

I've seen many questions asked about how to add images to the simulator and have seen two answers: - Click and hold to save in Mobile Safari on the phone - Add the files to the 100Apple (or whatever) folder Both worked great in everything previous to iOS SDK 4.0. Those same methods no longer work for me, and neither for anyone else that ...

App Store upload. Problem with SDK

I just tried to upload a completed app via iTunes Connect, and I received the following error: The binary you uploaded was invalid. Apple is not currently accepting applications built with this version of the SDK. I upgraded to the 4.0 SDK. I got this same exact error with the PREVIOUS version of the SDK as well. 3.?.? (whatever it was...

detect movements of objects on iphone by blowing air

hi all. I was just finding something on web I come to know that we can provide movements to different objects by blowing air on iphone from mouth. I tried but could not get how to do such things. so do any one know that how to move objects by blowing air from mouth. If any one do have any idea please tell me. If I am now wrong then...

UIScrollView animation laggy

Hello, I'm writing an reader for iPad that shows images (1024x1322 max) in a UIScrollView each image is loaded in a background thread when it's needed (during scroll) (there is always 3 images loaded at max). My problem is: when the data is loaded I'm updating the UIImageView, in my background thread like that: image= [[UIImage allo...