objective-c

How to reuse the sound again and Why my sound went off one page before it gets to the intended page?

I'm using Page Control example from Apple. I've been able to play sound on the app itself using this code below but for some reasons, the sound went off early one page before it gets to the page where i set my sound to be played automatically. - (void)viewDidLoad { pageNumberLabel.text = [NSString stringWithFormat:@"Page %d", pageN...

Update coordinate property of MKAnnotation on parent viewcontroller after Touch End event?

Hi, I have written an application with a draggable annotation which I have added on top of a MKMapView. I've added a CLLocationCoordinate2D variable called myloc in my main view controller to store the coordinate (lat,lng) values whenever I drag the annotation. My question is how do I update the myloc property value in the super parent ...

[NSThread isMultiThreaded] always YES?

[NSThread isMultiThreaded] always returns YES for my iPhone application, both in simulator and on the device, even if I run it first thing in applicationDidFinishLaunching:. It this expected? (I'm using Snow Leopard, if it makes a difference). ...

NSXMLParser Question

I am trying to figure out NSXMLParser for my iPhone app and while I generally understand how it works, I am still a little confused about how to extract the values I need. The XML result that I am parsing is very basic. it is like so: <start> <status>300</status> <record> <title>The Title</title> <content>Some content</content> ...

objective-c delegate

Hello, i working with geocoding at the moment. The geocoding service allways works with delegates. So let's say, I've got a AskingClass and AnsweringClass(geocoding) The AskingClass calls a function in the AnsweringClass to return the adress of the current location. AnsweringClass should handle and capsulate the geocoding stuff. My ...

Memory initialized in initWithCoder is lost in drawView

Hi, I have some memory which is initialized in initWithCoder:. I can verify that before the "return self" part of initWithCoder the memory is initialized. I allocate the memory using malloc and fill it using a custom function: // in initWithCoder: fontTexCoords = (GLfloat *)malloc(10 * 8 * sizeof(GLfloat)); [fontInfo textureCoordinate...

Objective-C class instance zeroed at alloc?

Is there any kind of memory-zeroing objective-c undertakes on my behalf when I first allocate a class instance? I see a lot of objective-c code out there that presumes their outlets are nil by default. If I do the same am I basing such behavior on false pretenses? ...

in cocos2d how can I create an array of sprites and put in a map pattern?

trying to create a space invaders game and putting the sprites in an upside down pyramid. I found this idea of using an array with a matrix to hold the pattern. array[3][5] { 11111 01110 00100 } the array has 3 rows and 5 columns. the 1's are the ships and the 0's is blank. can some...

2D Arrays in Objective C

I have a collection of NSObjects that I want to store in a 2D array generated at run time. In C# I'd just be using some of their friendly generic containers, but not too sure the best way to go about it in objective-c for iphone development. I'm guessing that NSMutableArray isn't the best route. I don't need the array to grow, I'll kno...

Memory Management Question in Objective C

I have a tableviewcontroller where I populate some data from a sqlite db and for each row, I download a file from a http server and cache it locally. I cache it only when the "detailsview" is opened. And the detailsview responds back to this table through a delegate after the file download is complete. But, when this tableview itself is...

UITableView frame height animation glitch

If I attempt to animate the frame height of a tableView (ex: height -= 200), the cells that appear in the last 200px disappear suddenly before the smooth animation of the frame completes. To make sure that it's nothing else I'm doing, I created a new View-Based application. In the main viewController I create my own tableview with enoug...

Is it possible to list variable names of a struct in objective-c?

if I have a struct say: struct myStruct { int someInt; flot someFloat; } Is there any way to get a list of the member variables? ie. someInt, someFloat? ...

BDD in Objective-C

I have recently started to learn Objective-C and write my tests using OCUnit that comes bundled with Xcode. I'm a long time Ruby programmer and I'm used to RSpec and Cucumber - nice BDD frameworks. Is there a decent BDD framework to use in Objective-C? I'm missing my 'should's :) ...

Making an NSTableView Display Articles From An RSS Feed.

How would I make an NSTableView display an RSS Feed (just one)? I think it would have something to do with NSURL and Setting the Table Views Data Source. But how exactly would I do this? ...

Tab bar + Navigation Bar

I have a two tab bar,In first tab ,i can drill down more than three... but in second tab i cannot drill down more than one.. Any ideas? code: DemoAppdelegate.m - (void)applicationDidFinishLaunching:(UIApplication *)application { [window addSubview:tabBarController.view]; } First tab controller is "FirstViewController" in FirstViewCont...

What are the benefits/limitations of MacRuby and has anyone used it to program for iPhone?

I keep running across references to MacRuby and was wondering if any of you have used it for iPhone/Objective C programming. The MacRuby website says, "the goal of MacRuby to enable the creation of full-fledged Mac OS X applications which do not sacrifice performance in order to enjoy the benefits of using Ruby." So, my question is: wh...

addSubview insertSubview aboveSubview bit confused as to why it does not work

I'm a bit confused all as to why the belowSubview does not work. I'm adding some (subviews) to my navigationController and all of that works well. -(UITableView *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { ... ... [self.navigationController.view addSubview:ImageView]; [self.navigat...

How to compare if two objects are really the same object?

I want to compare if an variable A represents the same object as variable B does. Could I do that with the == operator? Or what else is this exactly looking at? I think I need to check for the memory adress of the object where the variable is pointing to, right? ...

Encrypt resources in Cocoa app?

Hi, I have a shell script stored in the resources folder of my Cocoa app. If used improperly it could be dangerous (even though I have taken precautions to reduce exploits, such as using the absolute path to commands) so is there any way to encrypt the script in binary format, then decrypt it when it needs to be used? Thanks ...

Animate adding/removing UISearchBar to/from UITableView tableViewHeader

I have a subclass of UITableViewController. I have code that can add/remove a UISearchBar to/from the tableHeaderView of my tableView. Here's the code I have to perform these tasks: self.tableView.tableHeaderView = uiSearchBar; //Make the search bar appear self.tableView.tableHeaderView = nil; //Make the search bar disappear The probl...