objective-c

Objective-C class time delay?

I was wondering if anyone knows of a class in objective-C that stops/delays the application at a specified amount of time during runtime? I've already looked at the Time Manager and NSTimer and don't see how I could possibly put a delay in there. I've never used these two classes before though, so maybe someone else has and could give me...

How to get PDF chapter information with CGPDFDocumentGetCatalog?

Any sample code I can look at? ...

how do i store audio files in sqlite3 database and play them in iphone?

i want to store audio files(any of these formats mp3,wav,and iphone supported) in database and play them in iphone...any idea how to do this? ...

Which block of code is 'better'?

In order to promote good programming habits and increase the efficiency of my code (Read: "My brother and I are arguing over some code"), I propose this question to experienced programmers: Which block of code is "better"? For those who can't be bothered to read the code, is it worth putting a conditional within a for-loop to decrease t...

Objective-C subclass initWithSuperClass

The common Superclass of Rectangle and Circle is Shape. If I initialize some shapes, what is a good way of converting the shape into a circle later and keeping the same properties set while it was a shape? Should I implement a initWithShape in the subclasses that looks something like this? - (id) initWithShape:(Shape*)aShape { se...

‘NSAutoreleasePool’ may not respond to ‘-drain’ on Ubuntu

I'm trying to compile the following Objective-C program on Ubuntu Hardy, but for some reasons, I'm getting warnings. #import <Foundation/Foundation.h> int main (int argc, char *argv[]) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSLog (@"Hello"); [pool drain]; return 0; } Output of the compiler: $ gc...

Public scope in Objective-C?

Hi there! I’m sure this is a simple one, but it’s been elusive so far, and I’m stumped ... How do I declare an Ivar so that it’s accessible from ALL Classes in a project? [Don’t know if it matters, but the ivar in question is (an instance of) my Model class, whose data needs to be accessible to various view controllers.] Best as I ca...

C++ classes as instance variables of an Objective-C class

Hello! I need to mix Objective-C and C++. I would like to hide all the C++ stuff inside one class and keep all the others plain Objective-C. The problem is that I want to have some C++ classes as instance variables. This means they have to be mentioned in the header file, which gets included by other classes and C++ starts spreading to ...

Drag-drop from NSTableView to NSImageView

Hi, I need to drag a row from NSTableView containing an image path and drop it over NSImageView, and the image of the dragged row should appear in the imageview. Help appreciated ...

How to search nsmutablearray in objective c-iPhone app

Hi All, I am reading a RSS feed into nsmutablearray. i want to search the xml feed. for that i want to search nsmutablearray. i am very new to iphone apps. can some one helpme with this.. thanks, ...

iPhone: Problems with Formatted String (Objective C)

I need help. How come this does not work: NSProcessInfo *process = [NSProcessInfo processInfo]; NSString *processName = [process processName]; int processId = [process processIdentifier]; NSString *processString = [NSString stringWithFormat:@"Process Name: @% Process ID: %f", processName, processId]; NSLog(processString); But this doe...

How to find what day of the week for any given date using Cocoa

Hi, I'm trying to figure out what day (i.e. Monday, Friday...) of any given date (i.e. Jun 27th, 2009) Thank you. ...

How to display indeterminate NSProgressIndicator in the NSOutlineView?

I need to display a progress of loading of item's children. Please advise how to implement a progress indicator like it's done in Mail application: P. S. Here a source code of using indicator sub-views: http://snippets.dzone.com/posts/show/7684 ...

How to create a NSString from a format string like @"xxx=%@, yyy=%@" and a NSArray of objects?

Is there any way to create a new NSString from a format string like @"xxx=%@, yyy=%@" and a NSArray of objects? In the NSSTring class there are many methods like: - (id)initWithFormat:(NSString *)format arguments:(va_list)argList - (id)initWithFormat:(NSString *)format locale:(id)locale arguments:(va_list)argList + (id)stringWithForma...

Split String at specific line for NSString

Hello ist there a way to split a String for UITableView at a specific line to put the "rest" (the second part of the data) in an own cell NSString *data; CGsize *size = [data sizeOfStringWithFont:[UIFont systemFontOfSize:14] constrainToWidth:280.0]; if the size.height e.g. is greater than 1500 i want to split the string at this li...

A View Controller that can be instantiated both programatically and in IB?

A view controller FooViewController needs to do some initialization when it's created (of itself, not of the managed view - before the view is even loaded). I want to be able to create it in two ways: Programatically, possibly with some arguments: FooViewController *fooViewController = [[[FooViewController alloc] initWithSomeData:da...

UITabBarController, UINavigationController and autorotate

i have problem with autorotate on iphone i set up in all classes - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown); } but it is not respond ;/ Sample code is: http://b6.s3.p.quickshareit.com/files/testautorotatec...

CFReadStreamSetClient stops sending events at EOF

I have some code that downloads a file from the internet. Once I have written X bytes of that file to the local file system I tell another class to start reading it. CFReadStreamRef stream = CFReadStreamCreateWithFile(kCFAllocatorDefault, (CFURLRef)url); CFStreamClientContext context = {0, self, NULL, NULL, NULL}; CFReadStreamSetClient...

Transfer Images between iPhone and Web Service

Thanks in advance everyone! Background: I have a WCF web service running that is communicating with an iPhone app over SOAP. The WCF web service method is expecting a byte[]. Problem: Now I need to transfer images to and from the the iPhone app to the web service. I have been manually creating the SOAP request and sending it to t...

Defining a constant in objective-c

Hi, I want to define a constant in objective-c. Previously I had the following function: +(NSString *) getDocumentsDir { NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory , NSUserDomainMask, YES); NSString *documentsDir = [paths objectAtIndex: 0]; paths = nil; return documentsDir; } I'd like to...