objective-c

Cocoa-Touch: How to do layouting.

I have a view (UIScrollView), which loads some data, and displays various things from it in various subviews. So I have approx 10 subviews (UIImageView, UILabel) and I need to place them programatically considering their unpredictable contents (i.e. different height/width for the UILabels depending on the text property). From what I've ...

Is it OK to mix AudioServicesPlaySystemSound and AVAudioPlayer?

We have a game that is very close to being released, but we have one extremely annoying problem. One on of our Beta testers phones, he can't hear any of the in game sound effects. He can, however, hear the background music and the title screen music just fine. The background and title music are both being played via AVAudioPlayer (t...

I am looking for UITextFieldDelegate sample code.

I am looking for UITextFieldDelegate sample code. Please teach when knowing. ...

NSMutableURLRequest modifying header fields

NSMutableURLRequest apparently changes case on header fields. For example, setting: [request addValue:myValue forHTTPHeaderField:@"FOOBAR"]; will change the header field to "Foobar". Anybody know a way around this? I am working with a service that requires a case sensitive field to be passed. Also, NSMutableURLRequest shouldn't rea...

NSMutable Array - objectAtIndex: index beyond bounds

Hi everyone, I'm trying to look through a NSMutableDictionary loaded with an NSMutableArray and I'm messing it up, and I don't know how. I'm trying to load a larger plist of game questions, then delete them if they aren't the right level. I don't get an error until I try and delete. Can anyone see the flaw in this code? I'd super ap...

Method that gets executed when the application becomes active

Hi all, I have a very basic doubt regarding the method that gets executed when app becomes active. So this is the sequence 1.User executes an application for sometime 2.User presses the home button and goes to use someother app for sometime 3.User presses the home button and resumes using my app again. My question is which metho...

difference between drain, release,dealloc and retain in Objective-C/

Hi i want to know the difference between drain, release,dealloc and retain in Objective-C. ...

iphone gps cllocation and making variables globally accessible

Hi, I'm pretty new to iPhone development and have been trying to work out how to include GPS information into an app I'm working on. I've gone through the HelloThere tutorial, which is a great start http://www.mobileorchard.com/hello-there-a-corelocation-tutorial/ And had no problems getting this to run on my iPhone. I then took t...

UITableViewCell and UIImageView

I'm currently trying to fix the performance of my UITableView. Basically all it is is a custom UITableViewCell with a UIImageView. At the moment, this image is loaded in the tableView:willDisplayCell: method, however the performance is pretty bad so I decided to try and load the image asynchronously using an NSThread, but this results ...

How to convert every time zone in GMT +5.30?

I am creating an application. I am running a countdown timer and saving time into a database by converting time into a floating point value (double). Suppose I start the timer at 2.00 PM and set the countdown for 3 hours. After 1 hour I quit the application and on relaunch I am getting time stored from database. Count the difference betw...

Adding text after the the rows removed

Could anyone help me solve this problem please? I have a option called favorite, each time I choose my favorite song, the song will be added into inside that favorite option. So I made a table for it, and each cell will store each song the i choose. I can remove the song as well. But before I choose any song, inside that table I want it...

NSManagedObjectContextObjectsDidChangeNotification userInfo Dictionary.

I am using the NSManagedObjectContextObjectsDidChangeNotification notfication in my app, I already now how to use it. As I have used the below code to add the observer … - (void) awakeFromNib { NSNotificationCenter *nc; nc = [NSNotificationCenter defaultCenter]; [nc addObserver:self selector:@selector(syncKVO:) name:N...

Customized initializers and read only properties in Core Data

Before working with Objective-C and Core Data, I had occasions to create classes that needed to be initialized with certain parameters that, after initialization, could not be modified (though they could be read). With Core Data, I believe I can create a customized init on my NSManagedObject derived class as long as it includes a way to...

How does iStat for iPhone get the WiFi MAC & task list

Hello, iSTat shows a list of running tasks and also shows the Mac address of the Wifi connection. I understand that there's a way to get the Mac address via NSHost but it seems to be a private API. Also the task list is a mystery to me. Where do they get all that information from? Thanks! ...

trouble popping view controller off of UINavigationController

I'm having trouble popping a UIViewController off of a UINavigation controller even though the reference to the nav seems to be correct and a count on viewControllers shows the right number. I have a UINavController that gets it's first UIViewController set and then the nav controller is presented in a modal view: workoutNavController....

insertion and deletion in the table of objective C

Hi everyone I am wondering, I have an empty table and I want to display a text in that table, then I want to clear that text when the table has been inserted with something else. And the text will appear again when I completely remove everything in the table again.? ...

Using enum in Objective-C?

Is this the correct (or even a valid way) to use emums in Objective-C? i.e. The menuItem is not used but just defines a list add=1, load=2, list=3 etc. enum menuItems {add = 1,save,load,list,removeAll,remove,quit}; int optionSelect; scanf("%d", &optionSelect); switch (optionSelect) { case add: ... break; cheers gary ...

Managing UITextField.text property

Well, I have a UITextField. Inside it is a property UITextField.text. Is it ok to do: // Assume we have UITextField * tf somewhere.. // now set its text.. tf.text = [ [ NSString alloc ] initWithUTF8String:"Init'd with utf8" ] ; My problem with this is memory. What happens to the old value of the UITextField's text property. Don't ...

replacing escape character sequences in objective c

I have a query that returns a string, as well as an escape character sequence. (ex. "USA\"") I am using stringByReplacingOccurrencesOfString in this fashion: [theCountry stringByReplacingOccurrencesOfString:@"\"" withString:@""]; But it is still leaving behind a set of quotes. and if I were to try the method again to remove them: [...

looping through enum values

Is it possible to loop through enum values in Objective-C? ...