cocoa-touch

Does Instruments (ObjectAlloc/Leaks) require the simulator?

This may be a very stupid question so I apologize in advance. It seems that Instruments only works for me when using the iPhone Simulator. Is there something special to getting it working when tethering the application to the iPhone? Or is that even possible? I launch the application the normal way through the Run->Start with performace ...

Assignment Makes Pointer from Integer Without a Cast

I have an Obj-C method similar to this: -(void)getUserDefaults:(BOOL *)refreshDefaults { PostAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate]; if (refreshDefaults) { [appDelegate retrieveDefaults]; } } When I call it like this I get no warning: [self getUserDefaults:NO]; When I call it like ...

Dynamically instanting classes in Objective-C, possible?

My problem is the following. I have a method which simply takes an XML excerpt and an XPath. It then should create me an array of objects for that XML excerpt. Meaning if I get passed the following XML: <user> <name>Bob</name> <age>50</age> </user> My method will instantiate an instance of the class User and use key-value-coding t...

Key-Value coding and its scripting capability

I have an object which straight forward instance variables. Some are NSString, some are unsigned ints, etc. I was under the impression Key-Value coding was scriptable in that I could write code such as the following: id key, value; key = [[attributes objectAtIndex:j] name]; value = [[attributes objectAtIndex:j] stringValue...

How do I pass variables between view controllers?

i'm having a hard time with Xcode; for some reason, it just won't let me pass a variable from one view controller class to another. It should work, i was basically just copying/pasting from my other classes (it works on all of them... except this one). I've been at it all night long, tried everything i could think of and still it remains...

How to Cancel Scrolling in UIScrollView

I use UIScrollView to make large-sized (larger than 320px) UI on iPhone. I made an instance of UIScrollView and added some subviews on it. The problem is that I want to enable scrolling only when user touches outside of subviews, stop scrolling when user touches one of subviews. I read documents and tried to find samples but I can't fi...

How to reset saved data back to defaults?

I'm implementing saved data on my app by using NSUserDefaults, like this: [[NSUserDefaults standardUserDefaults] registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInt:0],@"mySetting",nil]]; // check int firstLaunch = [[NSUserDefaults standardUserDefaults] integerForKey:@"mySetting"]; // set [[NSUserDefaults...

UIAlert erroneous behaviour

// Tratamento de eventos: caso o utilizador clique numa das células da tabela Hello again guys, I was trying to display a UIAlertView to show the summary of a 'Movie' object i have stored and my idea was to show two buttons in it if i had the movie's website stored, or just to show one if the movie didn't have one. Oddly enough, i'm get...

How should I pass an int into stringWithFormat?

I am try to use stringWithFormat to set a numerical value on the text property of a label but the following code is not working. I cannot cast the int to NSString. I was expecting that the method would know how to automatically convert an int to NSString. What do I need to do here? - (IBAction) increment: (id) sender { int count = ...

In iPhone, How to remove contents from CALayer?

For iPhone developemnt, I have a CALayer with some image contents, when a button pushs, I want to remove the contens from the layer, and use this code: [m_aCellLayer setContents:nil] but I get EXC_BAD_ACCESS exception when running to line above, any Idea? Thanks ...

For iPhone app, Why setFrame increase the refcount ?

having these code: mainLyr = [[CALayer layer] retain]; [mainLyr setFrame:CGRectMake(0.0,0.0,23.0,23.0)]; in debugger, I found that after retatin, the refcount of mainLyr is 2, this is correct. but after setFrame, the refcount increased to 3, why? and how to determine if a method will increase or decrease the refcount (can not find tha...

Missing AVFoundation.framework

Hi, AVFoundation.framework is not where the documentation says it should be. I have iPhone SDK 2.2 installed (never had previous sdk versions installed) and I can't find that folder under /System/Library/Frameworks I did find it under /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.2.sdk/System/Library/Frameworks/ folde...

Do CALayers block Touch Events in underlying views?

I have an application with a view containing several subviews. The subviews did not implement any touchesbegins logic. The Superview implemented all touchesbegins logic and manipulated each subview respectively if it was touched (determined by hit testing). I have since been converting my subviews to layers. My problem now is that ...

ExtAudioFileOpenUrl giving EXC_BAD_ACCESS

Hello all, I have created a sample application using the iPhone SDK that uses ExtAudioFileOpenURL from the AudioToolBox framework. I have a test.mp3 audio file in my app's document folder. When I tried to open this audio file using this API I received EXEC_BAD_ACCESS. I couldn't figure out why. Here is a code snippet: NSArray *arr = N...

how the iphone multi-touch event triggered?

I read the SDK document, but can not understand some detail, need some help. for the touchesEnded: -(void)touchesEnded:(NSSet*)touches withEvent:(UIEvent*)event 1) what's the difference between touches and [event allTouches]? 2) If user release one finger, but still other fingers on screen, does the later event still contains the fing...

Why does iPod's audio not fade back in after my app caused it to fade out?

My app needs to play some audio files and I want to fade-out the iPod sound, play my file, and then as soon as my audio stops playing fade-in iPod again (just like iPhone handles iPod music when an incoming call comes in) I'm setting up my app's Audio Session to be kAudioSessionCategory_MediaPlayback and then just before I play my file ...

How can I scroll a UIView of indefinite size within a UIScrollView

I'm trying to draw a graph that is indefinitely large horizontally, and the same height as the screen. I've added a UIScrollView, and a subclass of a UIView within it, which implements the -drawRect: method. In the simulator, everything works fine, but on the device, it can't seem to draw the graph after it reaches a certain size. I'm...

A UITableView list of editable text fields

I know it might not be according to Apple's human interface guidelines for the iPhone, but I want to get rid of one level of pushing views and have a list of editable text fields. Further, I want the keyboard to be on screen from start when the view appears. The problem is that when I have more than three such fields then the pop-up key...

Finger scrollable UIWebView when the keyboard is up

In an application that I'm writing I have a UIWebview up top and some UITextFields at the bottom that I want the user to be able to type in depending on what's in the webview. But when they touch the Text Field and the keyboard pops up, the user loses the ability to manipulate the web page to see different parts. Is there a way to keep...

Backgrounds for UInavigationBar and UIPickerView

I understand that when you create a navigation controller it comes with a navigation bar, you are only able to select three backgrounds for this (example: translucent black etc). I've seen applications that have other colors like green with the "translucent black" type feature. Are they simply creating their own background view's and set...