objective-c

Subclass methods being ignored in Obj-C?

I have some confusion about an error in my Obj-C project. What I'm doing is fairly simple and don't understand what I am missing here. I am just creating a very simple method in a subclass of UIImageView, and then instantiating that class. When I try to use the method from my instance, the compiler complains it is not implemented (althou...

performance of iOS apps when compiling in debug or release / distribution mode

What are some performance differences when compiling your code in these mode? debug release / distribution are the default settings optimized for app store (distribution)? what are some ways to optimize performance even more by tweaking the settings? ...

Specify asset directory throughout app with multiple targets

Hi there, So, I have an application that has 2 targets. Each of these targets specifies a very different set of assets which populate that target's application. The idea here is that each target will build an application with completely different content, but the same core functionality. I have a reference folder for each target that h...

What's the normal way of organising a header file in Objective-C?

I do start off organising my .h files with the best intentions but somehow they get disgustingly messy. Below is an example (which isn't that bad, but i've seen much worse!). I've tried grouping sections with #pragma mark but it seems to look even messier. All the UILabels and UIButtons are required (as mentioned above) as they're sh...

How to download OpenStreetMap tiles from CloudMade?

how to download cloudmade map tiles? i have to download tiles with different zoom levels? how save these tiles to database for later loading? any sample code available? any help is appreciated.. ...

How would you mark up Messages from NSNotificationCenter and Protocolls in an UML-Documentation ?

I am not really a UML-User and relatively new to OO-Programming, i just used UML if i had to and it is long ago. Now i had to write an iPhone-Software and dont really know, how to realize Messages and Protocolls in an UML-Diagramm. And.. did i understand it in the right way, that in Objective-C is just one kind of inheritance ? You can...

How to replace string occur in NSMutableString from another string.

I have a NSMutableString that contains a word twice.(e.g. /abc ...................... /abc). Now I want to replace these two occurrences of /abc with /xyz. I want to replace only first and last occurence no other occurences. - (NSUInteger)replaceOccurrencesOfString:(NSString *)target withString:(NSString...

How to set selection style as blue if each cell is added an cell back ground image in iPhone sdk?

Hi Guys, I had a problem to set the selection style as blue, I have added the cell back ground image so that i can not set the selection style as blue how can i make it if we added images to each cell. (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = (UITabl...

How to write covariant readwrite properties in class continuations?

Given the following example // MyClass.h @interface MyClass { NSMutableArray *queue; } @property (readonly, retain) NSArray *queue; @end and // MyClass.m @interface MyClass () @property (readwrite, retain) NSMutableArray *queue; @end @implementation MyClass @synthesize queue; @end I get a Property 'queue' type in 'MyClas...

Custom Classes not being retained

I have a NSXMLParser that parses YT's API. It then turns all the videos into a class I wrote called video. Then the class is put into an array. Then back at my rootviewcontroller I access xmlParser.allVideos (xmlParser is a class I wrote that is the delegate for the xml parser. Here is what I do with it in the viewDidLoad: arrayFromXML ...

What should be passed into a :(NSString *)text

Hi guys, Feeling a little confused. I am trying to pass a NSString as an argument to this method -(void) setRightLabelText:(NSString *)text { rightLabel.text = text; } The code i use to call the method for(int index=0; index<5; index++) { NSNumber *num = [card.statsArray objectAtIndex:index]; StatView *statView = ...

Communication between a Cocoa and a C# application

I have an OS X server application written in Objective-C. I'd like to write a client in C# which runs on Windows systems. Which is the simplest way to do the communication between the two applications? I'm familiar with NSConnection, and I'd like to use something similar. The application is a very simple auction game. The clients pass...

Sharing data between two classes

Hi, this is my first iPhone application and I'm using JSON framework to decode JSON sent from a server. I insert the data in a NSMutableArray from an AppDelegate file. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { responseData = [[NSMutableData data] retain]; ...

Moving a View Up

Ok, this might sound simple, but somehow I can't get this function to work . - (void)setViewMovedUp:(BOOL)movedUp { [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:0.5]; CGRect rect = self.view.frame; NSLog(@"%f",self.view.frame.size.height); if (movedUp) { NSLog(@"test Moved Up"...

MGTwitterEngine - isUser:receivingUpdatesFor: always return HTTP error 400?

I have some problem to implement the method isUser:receivingUpdatesFor: from the MGTwitterEngine in order to check if a user is following another user on Twitter. Here is my code : //Here is how I call the method (isRequestIdentifier is an NSString declare in the .h) isRequestIdentifier = [[twitterEngine isUser:user1 receivingUpdatesFor...

What happen when we are writing [Obj autorelease] in Autorelease pool?

What happen when we are writing [Obj autorelease] ? For example: NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init];<br> NSMutableString *str = [[[NSMutableString alloc]initWithString:@""] autorelease];<br> NSLog(str);<br> [str appendString:@" I"];<br> NSLog(str);<br> [str appendString:@" like"];<br> NSLog(str);<br> [str...

get the array index in for statement in objective-c

Hey everyone; I am stuck in a stupid mess... I want to get not only the value of an array but also the index of the values. In PHP it's simple: foreach($array as $key->$value) Here $key will contain the index value. Isn't there a similar approach in objective c? How else could I achieve this? Please help! :(( ...

How to call a grandparent method

Hi, i need to call a grandparent method of my class. @class Grandparent +--->@class Parent +---->@class Child Every class implement a method: -(void)foo If i want to call the parent method foo from child class i use: [super foo] If i want to call grandparent's foo, how can i do? It's not possible to call [super [super f...

addSubview modifying the added view's frame

I'm not sure how to ask this question, but here goes... I am rendering a PDF page into a view and adding it to a UIViewController. Works fine, except for some PDF files. For some reason, the code goes through a different path for certain PDF files. It happens when the PDF is created from PowerPoint. After the addSubview call, it goes ...

EXC_BAD_ACCESS when setting ivars directly (without using accessors) inside -init method, why?

I've spent about 10 hours trying to find this bug that was causing my app to crash, and it was in the last place I looked (well it would have been, but last place I ever expected it to be). Originally I thought I had memory management issues (unbalanced retain/release) because the crash would happen every time I sent -removeAllObjects t...