objective-c

NSImage coordinate

hey guys, I have a large image, and then i'm extracting a portion of the image out via: [mBaseImage lockFocus]; NSBitmapImageRep* bitmapImageRep = [[NSBitmapImageRep alloc] initWithFocusedViewRect: NSMakeRect(startX,startY,width,height)]; [mBaseImage unlockFocus]; followed by: extractedImage = [[NSImage alloc] initWithSize:[bitmapIma...

How to determine the startdate (monday) of a week with a predefined date?

My example date is 08.10.2010 (friday), so the startdate should be 04.10.2010 (monday). NSDate *today = [[NSDate alloc] init]; NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; NSDateComponents *weekdayComponents = [gregorian components:NSWeekdayCalendarUnit fromDate:today]; NSDateComponents ...

% sign in string objective c

i am wondering how i do a % sign within a NSString, i have tried \% and \\% ...

What does @class do in Objective-C?

can any one please explain me what does @class declaration do in objective & what are the cases in which we should use this declaration. Thanks in advance ...

Relationships in CoreData

I am quite new to core data I have read a couple of articles on Apples dev site & now am somewhat confortable with using it with one entity. Now I am working on an app that recommends recipes to users. The datadesign is somewhat like this I have these entities Item , Pantry & Recipe . Relations are as follows: ...

Problem with iPhone memory leaking

I have a piece of Objective-C code I've inherited and the leak tracking tool has identified a memory leak in the code. I am not entirely up on the memory tracking rules of Objective-C so I'm having a real problem with understanding why the memory is leaking. The code is as follows: + (NSString *) getRecordingsDirectory { NSArr...

Conversion NSString to NSDate. 1 day is lost.

NSString *dateString = @"20.10.2010"; NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease]; [dateFormatter setDateFormat:@"dd.MM.yyyy"]; [dateFormatter setLocale:[NSLocale currentLocale]]; NSLog(@"%@", [dateFormatter dateFromString:dateString]); My output is: 2010-10-19 22:00:00 GMT Why is one day lost? ...

Wierd Switch case error (iPhone sdk) UITableView

Hi, I am getting a weird compilation error - I dont know if there is a "ghost in the machine" or what? Below if the code snippet where I am getting this error - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell ...

Problem in converting urlString into NSURL in iphone sdk

Hi Guy's I am having string at first the method calls with timestamp value nil and I am getting converted the string into url .next time when I click load more results button again the method calls with time stamp value assigned to it.but the url string is not converting into NSURL iam getting the null value into it. -(NSMutableArray*)...

How to associate a method with this button?

I have a navigation bar button that displays both image and text. This is the code: UIImage *saveImage = [UIImage imageNamed:@"star.png"]; UIButton *saveButton = [UIButton buttonWithType:UIButtonTypeCustom]; [saveButton setBackgroundImage:saveImage forState:UIControlStateNormal]; [saveButton setTitle:@"Save" forState:UIControlStateNor...

load the video type in the photo album using AssetsLibrary in objective C

Hi, i came across the following piece of code which loads everything from photo album but what should i do if i only wanted to load the video type in the photo album on a table? thanks in advance. void (^assetEnumerator)(struct ALAsset *,NSUInteger, BOOL *) = ^(ALAsset *result, NSUInteger index, BOOL *stop){ if(result != nil){ ...

Add a UIButton to UINavigationController programmatically

In Interface Builder you can drag a UIButton to the centre of a Navigation Controller, between the rightButtonItem and leftButtonItem. I would like to do this programmatically, as i am not loading a xib. I tried: [self.navigationItem addSubview:myButton] // no luck [self.navigationController.navigationBar addSubview:myButton] //no luc...

Question of Objective C on iphone

-(void)touchesBegan :(NSSet *)touches withEvent:(UIEvent *)event { [textValue resignFirstResponder]; [super touchesBegan:touches withEvent:event]; } can someone explain me the meaning of this method??? ...

Preprocessor Timestamp

Is it possible to generate an embedded Unix timestamp via a preprocessor macro? For instance: #define VERSION_EXPIRE __TIMESTAMP__ The reason for this is, that i have beta versions and i want to generate an expire timestamp on compile time (in a special Debug build configuration). Regards, Erik ...

Bootstrap Server Error in Xcode IPHONE

I get the below error many times and this error makes it impossible to run my application unless i restart the whole MAC. This is not caused due to changes in code. ERROR : "Couldn't register com.yourcompany. with the bootstrap server.Error: unknown error code.This generally means that another instance of this process was already runn...

Application idle timeout - Want to implement autolock for a specific idle interval

i want to implement auto lock for a specific idle time interval. How can i increase iphone autolock idle time feature programmatically ? Thanks ...

Can anybody give an idea or sample code to display "drop-down / combo / listbox" in iphone using objective-c ?! Please please help me out.

Can anybody give an idea or sample code to display "drop-down / combo / listbox" in iphone using objective-c ?! Please please help me out. ...

removeannotations not working?!

Hi, I am trying to make a map where I can look up locations, and put multiple pins on the map. and when I want to look up other locations I want to remove all the old pins. this is my code: -(void)addPins:(GeocodeLocation*) location { CLLocationCoordinate2D locatie; locatie.latitude = location.lat; locatie.longitude = location.lon;...

What is the intention of putting return values in parentheses in C/Objective-C?

I've come across some code that surrounds the return value from a method/function in parentheses. What does that do? The code I saw took an image, resized it and then returned it. - (UIImage *)resizeImage:(UIImage *)image { // // some fascinating, but irrelevant, resizing code here // return (image); } ...

When should I call super?

What is the best using of [super ... any method name]. Recently I have found out that In dealloc the [super dealloc] must stand in the same end. Because any variable what didn't use before can be filled by garbage if we set it after [super dealloc] It's a rare thing, but it's possible. After this we will have crash in our app. So what i...