cocoa-touch

IPhone - Which View Controller methods to use

I'm trying to figure out what logic should go into the different UIViewController methods like viewDidLoad, viewDidAppear, viewWillAppear, ... The structure of my app is that I have a root view controller that doesn't really have a view of its own, rather it has a tab view controller and loads other view controllers into it. But in the...

How to provide something like nil to this parameter?

I have a parameter like this: rightOperand:(const NSDecimal*)rightOperand how could I provide a value that represents "nothing" or "empty"? would that be void? i.e. [myObj rightOperand:void]; or something different? Or is that impossible for structs? ...

How can I find out the type of a NSDictionary element?

How can I find out the type of a NSDictionary element? ...

How to create a custom locale with a custom NSDecimalSeparator value?

I'm having trouble with + (NSDecimalNumber *)decimalNumberWithString:(NSString *)numericString locale:(NSDictionary *)locale Because I want to provide very high precision values programmatically to have no floating-point errors initially, apple gives me the only option to rely on a wonky locale. So the documentation says pretty encr...

Get to UIViewController from UIView on iPhone?

Is there a built-in way to get from a UIView to its UIViewController? I know you can get from UIViewController to its UIView via [self view] but I was wondering if there is a reverse reference? ...

How would an NSScanner expect a string for scanning an NSDecimal?

In Brad's CorePlot I've seen this snippet, which eliminated the need for some coffee. I'm totally awake now: NSDecimal result; NSScanner *theScanner = [[NSScanner alloc] initWithString:stringRepresentation]; [theScanner scanDecimal:&result]; And Apple says: A scanner’s locale affects the way it interprets values from the string....

sleep time into for loop

Hi: I need to make a for loop and between every loop wait 2 seconds and continue for (int i = 0; i < [stories count]; i++) { //my code //sleep 2 seconds and continue } How can I do this? ...

How to set an NSArray in NSUserDefaults?

I'm wondering why there is a -arrayForKey: method, but no -setArrayForKey: method. How could I set that array? ...

How to delete a user default value in NSUserDefaults?

I.e., my app sets some standard default values at the beginning. Then those values may get overridden by the user. And when the user messes things up, I want to set those settings back to my app default values. As I understand it, the app defaults are a different dictionary than the user defaults, and the user defaults just override thos...

[iPhone SDK] [Newbie] UITextView textViewDidChange will not be called?!

Hello, I have a small iPhone Project with a UITextView on my View, designed in the Interface Builder. In my Viewcontroller is an IBAction Method and I connected the UITextView to that IBAction. I also added in my controller .h the <UITextViewDelegate>. In my .m File I added the Method: - (void)textViewDidChange:(UITextView *)textView{...

motionBegan: Not Working

Hi Everyone: I am running into a bit of a problem when I attempt to use (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event in order to capture a shake event. The problem is that the function isn't even running, even when I override canBecomeFirstResponder and set it to return YES. I have seen some other people's posts...

Can't populate object property in uiviewcontroller on iPhone

I have a uiviewcontroller with two properties: trackName and playerObject. PlayerObject also has a trackName property. I call this uiviewcontroller from my main uiviewController with this code: SecondaryViewController *nextViewController = [[SecondaryViewController alloc] initWithNibName:@"SecondaryViewController" bundle:nil]; NSStrin...

CGMutablePathRef Memory Management

Do I need to release a CGMutablePathRef when I'm done with it? If so, how? ...

Where do I set my iPhone App's version?

The only place I can think to change is the version in my Target Properties. However, I would assume this is supposed to go somewhere in my Info.plist file as well? If not, how can I read this version info into my app at runtime (if it's in the plist somewhere, that's no problem). ...

Downloading images over the network is slow on the iPhone

I'm displaying a few images that are being downloaded over a network connection on a UITableView. Loading these images is extremely slow. Are there any performance tricks I can use? ...

How bad is it, in theory, if every class would include every other class?

Imagine an iPhone app with 30 classes. Every class has to interact with every other, so every class includes 29 other classes + foundation framework. I want to understand what's exactly happening when including a class. Does this duplicate the size in memory for that class in the app? Is it harmful to memory footprint and performance on...

Calculating columns with Core Data like SQL

Hey, I am sorting stores to get the closest stores. Furthermore I want to know how far away this shop is. The SQL query would look like this: select *, 6371 * 2 * ATAN2(SQRT(POWER(SIN((RADIANS(?) - RADIANS(latitude))/2),2) + COS(RADIANS(latitude)) * COS(RADIANS(?)) * POWER(SIN((RADIANS(?) - RADIANS(longitude))/2),2)), SQRT(1-POWER(SIN...

NSDirectoryEnumerator and unicode file paths

I am using NSDirectoryEnumerator to get all file names in a particular directory. It works fine until it encounters a Japanese file name. When I print this string (NSString) in gdb it prints a sequence of "?" question mark characters for the unicode part of the file name. If I use fileSystemRepresentationWithPath: to get a c string repre...

How does one add perspective to a UIImageView

I have a UIimageView and I need to give some perspective to the image. Maybe by modifying the vertex of the image... How can I do that? ...

Unloading ViewControllers from Apple's PageControl Example + UINavigationController's Relationship to its RootViewControllers

So I modified Apple's PageControl example to dynamically load various navigation controllers (along with their root view controllers) into the scroll view. I also added a technique that attempts to unload a navigation controller when it's no longer needed. I've only been at ObjC for a little over a month, so I'm not sure if I'm doing t...