cocoa-touch

How do I [legally] get the current first responder on the screen on an iPhone?

I submitted my app a little over a week ago and got the dreaded rejection email today. It reads as follows: Dear -----------, Thank you for submitting --------- to the App Store. Unfortunately it cannot be added to the App Store because it is using a private API. Use of non-public APIs, which as outlined in the iPhone Develope...

Is it wrong to use int in Cocoa and CocoaTouch?

What is the advantage of using something like NSInteger instead of int in code? I see this in examples a lot, including Apple's official code samples. ...

UITextView has no events

I am developing an iPhone application which requires a multiline text field (UITextView) to capture some text. When the user touches inside the textView it becomes firstResponder and displays the keyboard. What I really need it to do is remove the keyboard when the user is finished. Normally with a text field the return/done button pres...

Block touch propagation to other view

Hy, I have a childe view that put it self over other brother views. The problem is that when i touch it the brother also reacts at the touch event. How can I disable touch propagation on the underlieng brother views? ...

Objective-C NSURL URLWithString appears to fail when using variable

So this is my first posting on StackOverflow, so excuse me if my request is not well formed. I am attempting to load a variable with type NSString into an NSURL with the following line: audioPlayer = [[AudioPlayer alloc] initPlayerWithURL:[NSURL URLWithString:aArchiveItem.streamURL] delegate:self]; And in AudioPlayer implementation I...

Why doesn't delegate/datasource show in IB?

I have a uiviewcontroller declared like this: @interface RootViewController : UIViewController<UITableViewDelegate, UITableViewDataSource> I've dragged a tableview onto the rootcontroller's view. When clicking the File's Owner, all I see is tableview. Where is the delegate and datasource, which need to be connected for the tableview...

How to I style a UIToolbar to look like the standard iPhone camera toolbar?

The iPhone camera toolbar is gray and has a slight gradient. I believe I could achieve the same look by setting the tintColor and/or translucency of the toolbar. Any idea how I could make my toolbar look exactly like the camera one? This isn't quite right... too dark: UIToolbar *tb = [[UIToolbar alloc] initWithFrame:frame]; tb.tint...

OpenSource library to make OpenGL ES GUIs on the iPhone?

I'm looking for some kind of OpenSource library that allows me to make OpenGL GUIs on the iPhone ( for example the game menu , and some in-game pieces of interface like a player inventory ). Does anyone know if some sort of library/middleware exists for this ? A very big commercial example of this ( not for the iPhone ) would be: Scal...

Add a button to the Camera Toolbar on the iPhone

I am using a UIImagePickerController subclass to take photos in my app. The toolbar for the camera has a cancel button and a photo button on it. I would also like to add another button on the right. I have tried to add a UIBarButtonItem to the subclass's toolbar, but that doesn't work. I have also tried to make a UIToolbar that looks l...

Is there a way to display a UIBarButtonItem without using a UIToolBar... or even

Or even, is it posible to make the UIToolbar invisible? How can I achieve the effect of showing a standard UIBarButtonItem, without showing a UIToolBar? ...

Is there a function that triggers UIImagePickerController to take a photo?

I would like to trigger the camera with a non-standard button. What function do I call to trigger the camera? ...

Controlling Number of Application Executions

Is there a way to control the number of times an iPhone app executes. For example, I have a game called widget and I only want the user to play the game (new instance) no more that 20. Also, if tis is possible, how would you be able to stop the person from deleting then downloading the app again to get another 10 plays? ...

String & variable Help needed - iphone sdk

Hey guys, I have this quick problem I need to solve. I have a string here like so: textbox.text =@"Your name is" then I want to add right after "your name is" a variable that displays text. so in Visual Basic I learned it like this... textbox.text =@"Your name is" & variable1. but now i can see that it doesn't work like that in c...

UIProgressbar in Cococa Touch

Hi all, I want to display an UIProgressbar depending on the amount of data downloaded from the server. One way I implemented is I made a NSURLConnection and set the delegate. The - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response gave me the expectedContentLengh And in the - (void)connecti...

NSManagedObject subclasses and setValuesForKeysWithDictionary:

I am initializing a NSManagedObject subclass using: - (void)setValuesForKeysWithDictionary:(NSDictionary *)keyedValues I am also knowingly giving it the undefined keys, which of course should through an exception. So, I have implemented: - (void)setValue:(id)value forUndefinedKey:(NSString *)key If a key is undefined, I map it to ...

UISegmentedControl without rounded corner?

Is there a way of get rid of UISegmentedControl's rounded corners or it is the default behavior? ...

Undocumented Methods: Use them or not?

Hi, I want to know what the risks are of using undocumented methods in the iPhone SDK. I haven't had any issues thus far, but I am worried that doing something like this might screw up the app. Any opinions/suggestions are greatly appreciated. ...

Compare NSString accounting for articles (i.e. "the" and "a")

I thought caseinsensitiveLocalizedCompare: would take care of this (that is not including "the" and "a" in the comparison) , but it does not. (Also, In response to the first answer below, I understand that "case insensitive" part wouldn't help, but I thought that the "localized" part may help. I can't find any options to do this and g...

Export CGPath as JPG or PNG

Is it possible to take a path draw in an UIView with CGPath and export it as a PNG? ...

initWithContentsOfURL leaks memory within NSOperation subclass. Anyone else seeing this?

I have been living on Instruments for last few hours staring at a puzzling memory leak. I have isolated it to this single line of code in an NSOperation subclass I wrote: NSData *myData = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:myURLString]]; Periodically this will leak 3500 bytes. Is anyone else seeing this? If so,...