objective-c

UIImage setting value from filename in database

Hi All I have a SQLite database containing several items of data and in there i have included a column with the file names of the images i want to use in my app. I know how to pull this data out but i dont know the correct syntax to use to set that filename to the uiimage. Here is an example of what i thought it would look like. UIIma...

Something really dumb with return values

I'm doing something really dumb, and I don't see it. I've got an object doc with a method: -(float) currentOrient { return 50.5; } In another object, I call: -(void) showPage { float rot2=0; rot2 = [doc currentOrient] ; NSLog(@"SP rotation is %.2f", rot2); } However, the output is : SP rotation is 1112145920.0000...

An NSPredicate that can recursively traverse an object graph?

I'm trying to filter an array of objects that essentially form a tree-style graph. what i want to do is to filter out all objects from this array whose visible property is NO, or if its parent/grandparent/etc visible property is true (child objects can have the visible property be YES while its parent can be NO). I'm unclear as to ho...

How to know when a Core Animation has finished?

say I have... [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:0.5]; CGPoint position = myObject.center; position.x = position.x - 10; myObject.center = position; [UIView commitAnimations]; Core animation happens on a separate thread is there a way to know when an animation has finished? i.e., maybe there's...

Binding to an NSDictionary's "allValues" array

Am I misunderstanding something about bindings? I bind (an NSArrayController's content) to an NSDictionary's "allValues" array, and it thinks it's empty. I bind to a random object with a property that I've set to be that same NSDictionary's "allValues" array, and it works fine. Is this expected behavior, or am I doing something wrong? F...

how to get resource path using subpath Using NSBundle

Hi, Have the folder structure like *Resources/books/CD_en/icon/0.jpg; *Resources/books/CD_en/icon/1.jpg; *Resources/books/DD_en/icon/0.jpg; *Resources/books/DD_en/icon/1.jpg; how to get resource path from NSBundle using the subpath 'books/CD_en/icon/0.jpg'; I tried using, - (NSString *)pathForResource:(NSString *)name ofType:(NSStrin...

How to create a method for posting a notification in Objective-C?

Hi, How to create a method for posting a notification through the NSNotificationCenter and then call the method through applicationDidFinishLauching main method without any (IBAction) . I just wanted to send only a message.I also dont want the postNotification to be placed in applicationDidFinishLaunching method. -(void)applicationDid...

How to get the value for each key in dictionary in Objective-C?

Hello, I'm maintaining a NSMutableDictionary which holds key and value pair.Now i need to perform some operation for each value in it.How to retrive value from dictionary. // this is NSMutableDIctionary NSMutableDictionary *dictobj = [[NSMutableDictionary alloc]init]; // in methodA -(void)methodA { //get the value for each key and...

Method overloading in Objective-C?

hello, as far as my knowledge, objective-C does not support method overloading.What can be the alternative for this in Objective-C? or should i always use different method name? ...

How to create a class to send and receive events through NSNotificationCenter in Objective-C?

Hi, I need to create two classes and both should be able to send and receive the events through the NSNotificationCenter methods.ie Both should have the sendEvent and receiveEvent methods: @implementation Class A -(void)sendEvent { addObserver:--- name:---- object:--- } -(void)ReceiveEvent { postNotificationName: --- object...

How can I use Objective C outside of Apple i.e. open source Objective C?

I would like to start using Objective C for something projects, however I don't want to use any frameworks and libraries that are tied to Apple. What can I use to write portable code across Mac OS X, Linux, and maybe even Windows? EDIT: I was thinking of very fundamental libraries like the FoundationKit and all that. I want to use Obje...

NSOutlineView Sidebar help

I'm trying to create a simple sidebar using NSOutlineView..... how would I do this? (I'm using CoreData) ...

scale image of size 1600*1200

hi, I am developing image size based iphone application. selecting two photos of size 1600*1200 from photo library and merging of both to single image and save to same library. Again if i check the image size it shows 600* 800. How to get original size(1600*1200) of created New photo(600*800). Thanks in advance. ...

Trailing slash important, but stripped out?

If I create a url a la: const UInt8 *pFilepath = (const UInt8 *)[[NSHomeDirectory() stringByAppendingString:@"/Documents/"] UTF8String]; CFURLRef ldestination = CFURLCreateFromFileSystemRepresentation (NULL, pFilepath, strlen((const char*)pFilepath), false); and then log it to see what I've got a la: NSLog(@"destination url:%@",(NSSt...

To Convert UIImage's into video format using FFmpeg libraries in iPhone

Hi All, I want to develop an application in iPhone 3g of video recording and for that i'm using FFmpeg library i'm able to compile it but unable to get the code for this. Can anyone help me in solving the problem? If possible can anybody help me through code or any link to github or like that? Thanks in Advance. ...

iPhone multitouch event can't get

Hello guys! What do you think, what is the problem with my simulator or I don't know, with my code. Here is the code - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { if ([touches count] == 1) { // code } else { // code } } And when I simulate the double tap with the Option key in simulator, the code al...

how can i put the second line in the table view cell in objective-c ?

I am using the following code to add the next line in the same same but i am not getting the output. cell.detailTextLabel.text= [self.dataArray1 objectAtIndex:indexPath.row]; where dataarray1 is the following array. self.dataArray1 = [NSArray arrayWithObjects:@"sugar : 1 teaspoon", @"salt : 1 teaspoon",@"sugar : 1 teaspoon",...

Calculate position of NSScrollView relative to main image.

Assume I load an NSImage of dimensions 2000x2000 and display only a portion of the picture inside an NSScrollView with frame size 500x300. How can I calculate the distance between the images 0,0 origin and the views 0,0 origin (so I can determine the x,y coordinates of the view relative to the whole image)? Thanks in advance :-) ...

How to access a variable from an object in Objective-C?

Hi, How to access a variable from an Object in Objective-C. ie if i have a variable of say: (NSString*) string; How do i access this through an object? ...

iphone objectiveC alloc/release question

Hi, I am new to ObjectiveC language. I am having trouble understanding memory management syntax. My code is below: NSDate* someDate; someDate=[[NSDate alloc] init]; loop { someDate=[[NSDate alloc] init]; } will I have a memory leak here ? or the NSDate object returned is [autorelease]? Thanks ...