iphone

Custom UIView with keyboard input?

I have a custom UILabel subclass for displaying currency values. I only want the user to be able to enter digits and let the view format those digits into a currency value -- like a cash register. This makes UITextField an inappropriate choice for this kind of input. I've already overridden hitTest: so that the UILabel will return itsel...

iPhone UIwebview with embedded quicktime video?

When I load a HTML page with a .MOV embedded video on my App using a UIWebview it appears a broken icon, any idea? The same HTML page on Iphone Safari works fine and the media player is started without problem... ...

How can I record AMR audio format on the iphone?

A voice recorder doesn't need uncompressed Linear PCM audio. Compressed AMR would do fine. The iPhone framework built for recording audio is simple enough, but the only examples I've found for setting up the audio format (which come from Apple) use LinearPCM. I've tried various other combinations of values, but can't seem to get anyth...

How can I dynamically hide a button from a view?

I would like to dynamically hide a button in one of my views, depending on a certain condition. I tried adding some code to the view controller's -viewWillAppear method, to make the button hidden before displaying the actual view, but I still don't know how to do that. I have a reference to the button through an IBOutlet, but I'm not s...

Starting iPhone app development in Linux?

I've heard that you need to get a mac if you want to develop iphone apps. Is it true? Is it possible to develop iPhone Apps using Linux. If yes what do I need and where to download the necessary tools such as sdk? ...

Remove HTML Tags from an NSString on the iPhone

There are a couple of different ways to remove HTML tags from an NSString in Cocoa. One way is to render the string into an NSAttributedString and then grab the rendered text. Another way is to use NSXMLDocument's -objectByApplyingXSLTString method to apply an XSLT transform that does it. Unfortunately, the iPhone doesn't support NSAt...

iPhone image upload in background.

I'm writing an app with an image upload feature. Right now I'm using NSURL POST like: 125306. When the app is closed as far as I can tell all of the uploads abort and the threads die. Is there 1) a way to make these upload threads persist when the app is no longer in the foreground? 2) an iPhone OS service that will accept requests ...

Using RSpec for iPhone Controllers

I'm finally getting the hang of RSpec after spending a couple of hours over the weekend. Now I'm stuck trying to figure out how to assert that parameters are indeed passed into the controller. I'm following the Bowled over by Ruby/Cocoa example and adapting it for the iPhone SDK. I've done a more detailed writeup of my progress on my blo...

UIWebView - how to get visited links to display as visited?

I have a UIWebView in my iPhone app, which merrily shows web content, but it does not render visited links any differently to unvisited links. Ordinarily I'd expect it to use a different colour for visited links, but alas no. Safari on the other hand deals with its links correctly. I assume that UIWebView is lacking a store of informati...

How do you get the number keypad to come up in an iPhone webApp?

On a web page that is to be displayed on an iPhone, is there a way to get the number pad to come up when the user taps in the field, instead of the qwerty keypad? This guy says here's how to do it, but as of 2.0, this "feature" was disabled. I'm guessing there's some fancy javascript to employ to get around this limitation? ...

UIViewController vs. UIView - which one should create subviews?

I'm trying to wrap my head around the roles of UIViews and UIViewControllers. If I'm creating and inserting subviews programmatically, is it typical to do this from the view or the controller? I'm really just wondering if there's a convention/pattern for this. In my sample application, I'm loading 50 images at runtime, adding them as ...

iPhone - Memory Leak - NSData dataWithContentsOfUrl & UIWebView

Please help! Have been staring at this for 12 hours; and have looked online and can't find solution. In my application, I use 2 UIView controls in separate pages/controllers: UIImageView (retrieve data via NSData dataWithContentsOfUrl) UIWebView Just to isolate my code, and make it easier to explain, I created a new view based proje...

What is the best way to know when the UIViewController above me in the stack has been popped?

I have a UIViewController that manages the display of some data. When the user wants to edit this data I push an edit UIViewController onto the stack. When the user is finished editing the top view controller is popped off the stack. What is the most elegant way to know that I need to update my display after the edit view is popped off? ...

How to customize the background color of a UITableViewCell?

I would like to customize the background (and maybe the border too) of all of the UITableViewCells within my UITableView. So far I have not been able to customize this stuff, so I have a bunch of white background cells which is the default. Is there a way to do this with the iPhone SDK? ...

How to quickly switch the status bar background style when an application is started?

This might be a bit difficult to explain in writing, so please bear with me here. Whenever I wanted to customize the style of the status bar to the "dark" one, I simply add the following line to my AppDelegate's -applicationDidFinishLaunching: method: [application setStatusBarStyle:UIStatusBarStyleBlackOpaque]; This works great, but ...

Run a method on tab switch or when leaving a UIViewController's focus

I'd like to run a method when a user switches to another tab or when the application is closed. Is there a way to do this with the iphone sdk? I've tried looking at the methods for the view controllers and the tab bars, but I didn't see any methods that seemed to do this. I've also tried doing this with "Editing Did End" methods, but...

In CocoaTouch (iPhone OS) how do I find/eliminate leaks that the Instruments Leak tool doesn't find?

I have an iPhone app that is running great in the simulator. It responds well to the memory warnings by getting rid of everything that is not absolutely essential. When I run it on the device, it runs well. But after a certain amount of usage it crashes with error code 101 - which, from what I can tell, is the OS killing it due to mem...

NSXMLParser and entity references

What do I need to do to NSXMLParser so it handles entity characters? For example, if I have the following element <anElement>Left & Right</anElement> I am only getting " Right" in the parser:foundCharacters: delegate method. Thanks. ...

Screen Off event or property on iPhone

Hello, Is there a way to determine if the screen has been shut off via the top Power button? I just need to know if the screen has been somehow set to off to kill a loop that updates location. Thanks ...

Background color for UIActivityIndicatorView

I am using UIActivityIndicatorView to showing user that there is something going on, let them wait. But UIActivityIndicatorView looks small, do not have background color, and not very obvious to the user. While in iPhone SDK's UIImagePickerController, it uses the similar mechanism, but with the black background as well as some text besid...