cocoa-touch

Evernote app "Tips" image overlaying UITableView

The Evernote application has a tips pane which hangs over a UITableView on the initial window. When you click on tips, a straight forward animation happens with a tips pane sliding up into view. My question is, how is that tips pane implemented in the sense that, you absolutely have to click on the tab sticking out for it to animate. An...

Fixed labels in the selection bar of a UIPickerView

In the clocks application, the timer screen shows a picker (probably a UIPicker in UIDatePickerModeCountDownTimer mode) with some text in the selection bar ("hours" and "mins" in this case). (edit) Note that these labels are fixed: They don't move when the picker wheel is rolling. Is there a way to show such fixed labels in the selecti...

UIViewController not loading my custom UIView

This should be straight forward for a guru. I don't have any code really written out, just a couple of controllers and a custom UIView. All connected through nibs. The app loads without crashing, yet I can't see my NSLog() hit from my custom UIView. My application delegate has default template code which calls for a class of mine called...

Awake from sleep event on the iPhone?

Is there any way to detect if the iPhone wakes up from sleep while you're app is running? Eg: your app is running, the user locks the screen (or the screen auto locks) and some time later the user unlocks the screen and up pops your app. Is there some way to get an event at that point or detect it somehow? I've tried searching the Goog...

How to check if NSTimer has been already invalidated

Hi, I have a NSTimer object that I need to invalidate if a user taps on a button or if they exit a view. So I have: [myNSTimer invalidate]; inside my button handler and inside viewWillDisappear. If user taps on a button and then exists a view the app throws an exception because myNSTimer has already been invalidated. What I need to d...

Using Interface Builder tags

I'm using interface builder's tag feature to access some UILabels I'm instantiating in a xib file. Since this a UITextViewCell I want to avoid superfluous method calls, but I want to do it right too. Thus when I do: UILabel *label = (UILabel *)[cell viewWithTag:1]; I'm wondering if I should wrap it up like so: if([[cell viewWithTag:1...

Dealing with variable assignments and async requests

I'm looking for a reliable design for handling assignments that have asynchronous requests involved. To further clarify, I have a class which handles Data Management. It is a singleton and contains a lot of top level data for me which is used throughout my iPhone application. A view controller might do something such as the following: ...

Programatically Switching Views in Cocoa Touch

How would one change the view on the screen programatically in an iPhone app? I've been able to create navigation view's and programatically push/pop them to produce this behaviour, but if I wanted to simply change the current view (not using a UINavigation controller object), what is the neatest way to achive this? A simple example, i...

How do I convert NSDecimalNumber to NSInteger?

OK, I'm using a JSON-enabled Rails web-service to provide data to an iPhone application. I'm finding my Integer values (IDs) are being interpreted by the json-framework as a NSDecimalNumber type. I need it as an integer. How can I get an integer value out of my NSDecimalNumber typed variable? I have tried everything I know, and I'm at my...

Asynchronous vs Synchronous vs Threading in an iPhone App

I'm in the design stage for an app which will utilize a REST web service and sort of have a dilemma in as far as using asynchronous vs synchronous vs threading. Here's the scenario. Say you have three options to drill down into, each one having its own REST-based resource. I can either lazily load each one with a synchronous request, bu...

UiTextField in Landscape Orientation

For the life of me I can't figure out how I'm supposed to set the UITextField to display the text vertically (landscape mode) instead of horizontally (portrait mode). The keyboard shows up properly, but when the keys are pressed the text is entered in the wrong orientation. Here is the screenshot for the window And here is the code for...

How can I set a button background color on iPhone?

How can I set a custom background color of a button? Interface Builder doesn't seem to have an interface to do this. Is it only available programmatically? If so, can you provide an example, please? ...

How to identify the current view which is on display

If I have 3 different views which are defined in 3 corresponding functions, namely: - (UIView *)getView1 { /*...*/ } - (UIView *)getView2 { /*...*/ } - (UIView *)getView3 { /*...*/ } These are added to self.view when a particular view is required. My question is, how do we know which of these views is currently being displayed? Is th...

UITextField in UIAlertView on iPhone - how to make it responsive?

I placed a UITextField into a UIAlertView and moved it up so the keyboard wouldn't cover it up with the following code: [dialog setDelegate:self]; [dialog setTitle:@"Enter Name"]; [dialog addButtonWithTitle:@"Cancel"]; [dialog addButtonWithTitle:@"OK"]; UITextField * nameField = [[UITextField alloc] initWithFrame:CGRectMake(20.0, 45.0, ...

Editing a UITextField inside a UITableViewCell fails

In my application I have a UITextField inside a UITableViewCell. If I click inside the text field and add some text I find that if try to move the insertion point it works the first time but fails on subsequent attempts. I am completely unable to move the selection; no "magnifying glass" appears. Even more curious, this "setting" seems ...

Determine Free Disk Space Allowed By Sandbox On iPhone

I am looking for a way to determine how much free disk space there is available to my application. I have tried using NSFileManager's fileSystemAttributesAtPath with NSFileSystemFreeSize, but this is giving me the total free space on the iPhone and not what is available to my application by the Sandbox. I believe applications are limit...

How do I open the Settings application from my application?

In an iPhone app I'm working on, the user needs to enter some configuration via the settings application before my app will be able to connect to a server and run. Right now when the user first launches my app, I display an alert explaining that the user should go to settings, enter the config details and then relaunch, but this isn't id...

Which should I use, -awakeFromNib or -viewDidLoad?

I recently had a problem in my app where some of the subviews I was creating in a UIViewController subclass's -awakeFromNib method were disappearing from the view. After some poking around I found that moving the code I had put in -awakeFromNib to -viewDidLoad solved the problem. Seems that -awakeFromNib gets called only once when the U...

navigation items disappearing from UINavigationBar

Hi I am adding a custom background image to my navigation bar by creating an image view and doing a [navigationController.navigationBar addSubview:imageView]. The background comes in fine. But as soon as I do this, my other navigation items start behaving in a strange manner. Sometimes the navigationItem.title appears, the back button ...

Key-Value Coding with Objective-C

I had a straight forward approach of turning Key/Value pairs of an XML excerpt into an NSDictionary when I started a simple iPhone application. The problem is, I need to turn those NSDictionary's instances that once populated my UITableView's into custom classes because they require behavior and additional complexity. The problem here is...