objective-c

how to rename or change file name case on the same location in objective-c

Hi, I am working on application which required me to change the filename case retaining the original filename as it is For Example: need to change abc.txt => (ABC.txt or Abc.txt or abc.TXT or abc.Txt) filename as well as its extension can be change in same way. I tried to use the NSFileManager - (BOOL)movePath:(NSString *)source toPath...

Loading multiple images in sequence on iPad

I'm working on an application that talks home to a server and retrieves some data with image URL's embedded in it. I want to display those images on the view, and am getting them like so: UIImageView *ivAvatar = [[UIImageView alloc] initWithImage:[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:self.avatarUrl]]...

Managing NSXMLParser loaded data across the application.

I have an xml file that I need to load. This xml file holds data that needs to be accessed by a few classes. I'm wondering what the best approach would be to deal with this. Basically I need a way to keep the data centralized and allow various classes to access it. Either that or have each class re-parse the xml file for the data it ...

How to make text in a UITableViewCell wordwrap?

I have a grouped UITableView with a few sections. The text in some of the cells can get quite long, I was wondering how I could make the text word-wrap? ...

What does the -all_load linker flag do?

I can't find anywhere what the -all_load flag do when compiling Objective-C code. I have some issues uploading binaries to Apple, the they say it's because I didn't use this flag, but my code compiles even without it. Can some one help me with that? Thanks ...

How to scroll UITableView to a certain position?

I would like to scroll my UITableView 2 cells down when clicking on a button. The total height for the shift downwards is 100px. How can I accomplish this? ...

Memory management error, using cocos2d for iPhone

Hi, So I'm getting a EXC_BAD_ACCESS error in cocos2d. From what I've been searching so far it's mostly related to attempting to free an object which has already been released. I have encountered this error before, and its solution was simple and pretty much caused by freeing a released object. But now, using cocos2d (not sure if it's a ...

Replacing text in NSTextFieldCell inside NSTableView

Whenever a user would type a number, my app would automatically prepend a currency sign before that number. For example, when the user types "1" in a text field, the text inside it becomes "$1.00". All is good when I use an NSNumberFormatter, an NSTextField, and its delegate method control:didFailToFormatString:errorDescription:. - (BOO...

How do I call javaScript from Objective C?

I'm developing a WebKit Safari Plugin with Xcode. How do I call JavaScript from -webPlugInStart? ...

Lua and Objective C not running script.

I am trying to create an objective c interface that encapsulates the functionality of storing and running a lua script (compiled or not.) My code for the script interface is as follows: #import <Cocoa/Cocoa.h> #import "Types.h" #import "lua.h" #include "lualib.h" #include "lauxlib.h" @interface Script : NSObject<NSCoding> { @public s...

Is it possible to code Objective-C on Windows?

I would like to test Objective-C but I haven't a Mac. Is it possible to program Objcetive-C on Windows. Another possibility is to do it in Linux. Anyone who knows? ...

What is the proper way of hard-coding sections in a UITableView?

I have a UITableView with 3 sections that are hard coded. Everything is working fine, but I am not sure if I am doing it correctly. Define number of rows in section: - (NSInteger)tableView:(UITableView *)tblView numberOfRowsInSection:(NSInteger)section { NSInteger rows; //Bio Section if(section == 0){ r...

Using the system localizations on iPhone

I want to make a back button for a navigation controller with the title "Back" instead of the title of the previous controller. I'm using this code: UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Back", @"Back") style:UIBarButtonItemStyleBordered tar...

iPhone OS: making a switch statement that uses string literals as comparators instead of integers

So i'd like to do this: switch (keyPath) { case @"refreshCount": //do stuff case @"timesLaunched": //do other stuff } but apparently you can only use integers as the switch quantity. Is the only way to do this parse the string into an integer identifier and then run the switch statement? like this: nsinteger n...

setDelegate:self, how does it work?

I have a query regarding how delegates work. My understanding was that delegates take responsibility for doing certain tasks on behalf of another object. locationManager = [[CLLocationManager alloc] init]; [locationManager setDelegate:self]; [locationManager setDistanceFilter:kCLDistanceFilterNone]; [locationManager setDesiredAccuracy:...

Working through exercises in "Cocoa Programming for Mac OS X" - I'm stumped

I've been working through the exercises in a book recommended here on stackoverflow, however I've run into a problem and after three days of banging my head on the wall, I think I need some help. I'm working through the "Speakline" exercise where we add a TableView to the interface and the table will display the "voices" that you can ch...

Switching Between Subviews in iPhone App

So, in an iPhone app I am working on, I've decided that the best way to display all the contents to the user is to have the top part of the screen show some information, and the bottom of the screen show different information. However, the bottom part will change sometimes, so I was working on implementing that. Another app that does t...

NSDateFormatter return nil on 2 different input which in same format!?

Hi all! I am newbie of objective-c and i got this crazy problem… for low precision test case: dateString = @"2010-05-25 11:05:21", conversion success. dateString = @"2010-03-01 15:54:36", conversion fail. for high precision test case: dateString = @"2010-05-25 11:05:21.937113", conversion success. dateString = @"2010...

Mingling C++ classes with Objective C classes

I am using the iphone SDK and coding primarily in C++ while using parts of the SDK in obj-c. Is it possible to designate a C++ class in situations where an obj-c class is needed? For instance: 1) when setting delegates to obj-c objects. I cannot make a C++ class derive from a Delegate protocol so this and possibly other reasons prev...

Objective C sound lagging when multiple repeat

Hi, i'm coding in simple game where i move a square which performs a sound effect each time the square's moving. (like a walking sound) Problem is playing the sound effect cause a display refresh lag. As if it was too much performance for the engine. I was asking if there's a way to properly play the repeatitive but not continuously sou...