objective-c

Mouse events for an NSSegmentedCell subclass?

I'm trying to implement some rudimentary tabs in a Cocoa editor I'm working on. I am using an NSSegmentedControl and adding segments to it as tabs. I'm using a custom NSSegmentedCell subclass for the tabs to draw a little 'x' icon next to the text for closing tabs and so far it's been going pretty smooth. However, I cannot figure out ho...

how can i trace the finger movement on touch for drawing smooth curves??

like what i want is if i move my finger fast on the iphone screen , then i want like something that it make a proper curve using quartz 2d or opengl es whatever. i want to draw a path in curve style...... i had seen that GLPaint(OpenglES) example ,but it will not help me alot , considering if your finger movement is fast..... something...

iPhone Obj-C: Anonymous Category or "private" Category?

Style-wise (and functionally, if there is any difference), for declaring private methods, which of these is better? @interface MyClass() @interface MyClass(private) ...

Why are subviews of an NSView not sent a release message when a Cocoa application terminates?

The short version: Why are the subviews of NSView objects not sent a release message when a Cocoa application terminates? Is there a way to override this behaviour? An example: The MyView class shown below is nothing more than an NSView subclass that reports to the console when it is created and destroyed. I have tested it out and ...

In Cocoa, how do I use NSTimeZone to get the system time zone offset as a string?

For PDT, I would want "-0700". I'm getting a date in the past to determine how long ago something happened. NSDate *then = [NSDate dateWithString:@"1976-04-01 12:34:56 -0700"]; // Note the hard-coded time zone at the end I'll be constructing the date string elsewhere but I don't know how to access the local time zone. I read the App...

Core data, NSArrayContainer Arraycontent of many arrays

Hello I've got three entities in my application so far: tag, feed and story A tag has got a to-many relationship to feeds and feeds has got a to-many relationship to story. I've got an NSArrayController for each entity, one named tags, one named feeds and one named stories. They all share the same 'managedObjectContext' which they ge...

Fuzzy Date algorithm in Objective-C

I would like to write a fuzzy date method for calculating dates in Objective-C for iPhone. There is a popular explanation here: http://stackoverflow.com/questions/11/how-do-i-calculate-relative-time However it contains missing arguments. How could this be used in Objective-C?. Thanks. const int SECOND = 1; const int MINUTE = 60 * SEC...

How to get instance of UIView subclass from app controller.

If I subclassed a UIView from interface builder, and now need an instance of that subclass in my app controller, how would I get that reference (To the subclass and not the UIView)? ...

Thousands of new 0 size objects being added to my net total every second, should I be worried?

I have just finished ridding my project of leaks, but there are still thousands of objects under the category "GeneralBlock-0". The number of net allocations is through the roof (its approaching a million as I type) but none of them are leaks and none of them have a size greater than 0 bytes. UPDATE & EDIT: QuartzCore is responsible f...

Objective-C: Class vs Instance Methods?

Hi, What's the difference between a class method and an instance method? Are instance methods the accessors (getters & setters) while class methods are pretty much everything else? Thanks, ...

Is there a way to create a non-rectangular UIButton?

I have buttons laid out diagonally with their image frames as shown in the picture below. How can I alter the corner points so the buttons don't significantly overlap? I know I could just create a rectangular UIButton and rotate it, but I may eventually need custom-shaped buttons anyway. Also, my button images are essentially text wit...

Are there any Calendar View components out there?

I am looking for component that draws a calendar grid View, similar to Apple's "Calendar" app. Can't find anything on google. searching for "calendar" or calendar, view, component is too generic term to find anything useful. There are a lot of apps in appstore that have calendars, do they program calendar views at low-level by drawing ...

iPhone HTTP REST Requests/Responses

Hi All, I am very new to the iPhone SDK and have read many threads on RESTful service integration with the iPhone. However I am none the wiser. Can you help? I have some PHP and a MySQL database string on a server. I POST 3 pieces on information from the iPhone to the PHP which then does some thinking and chatting to the database. It t...

How to access other objects from within NSOperation? Threading issues lead to crash.

I have app that performs login to web service and then requests list of objects using sessionid received during Login. Appdelegate.h .... @property (nonatomic, retain) NSString *sessionId; AppDelegate.m: -(id)init{ queue = [[NSOperationQueue alloc] init]; [queue setMaxConcurrentOperationCount:1]; ..... } - (void)applicati...

Getting magnetic north from a xyz magnetometer (iPhone 3.0)

I'm actually reposting a question from the iphone development boards. I didn't ask it, but I found it when trying to find its answer. Nobody had yet responded there, so I thought I'd try posting it here. Thanks in advance for any help! Does anybody know any specifics about the algorithm of computing the magnetic heading from the raw ...

UITableViewCell's imageView fit to 40x40

I use the same big images in a tableView and detailView. Need to make imageView filled in 40x40 when an imags is showed in tableView, but stretched on a half of a screen. I played with several properties but have no positive result: [cell.imageView setBounds:CGRectMake(0, 0, 50, 50)]; [cell.imageView setClipsToBounds:NO]; [cell.imag...

NSNotificationCenter selector won't work with its NSNotification

I'm working on a Cocoa project with some C in it (I know, objc contains C...) and am trying to understand NSNotificationCenters. Here's the situation: I have a struct declared as typedef struct {/*code here*/} structName; In my - (id)init method, I have [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(selName...

Convert int to CGFloat

Any idea on how to convert int to CGFloat in objective C? ...

Using NSMethodSignature on iPhone (with Obj-C 2.0 properties)

Hey guys, I'm running the following code on my phone, where 'object' is a Cat, which is a subclass of Animal. Animal has a property 'color': NSLog(@"Object: %@", object); NSLog(@"Color: %@", [object color]); NSMethodSignature *signature = [[object class] instanceMethodSignatureForSelector:@selector(color)]; NSInvocation *invocation = [...

Can I increase the animation speed of presentModalViewController?

I'm writing a drawing application that shows a tools view controller when the user clicks an item in a toolbar. However, several of my beta testers have reported that the tools palate opens too slowly. I'm using the standard presentModalViewController:animated: call to display the tools, and I've tried wrapping it in a code block like th...