cocoa

NSButtonCell created programmatically doesn't highlight when clicked

I wanted to have a button appear in a table view as the first element on the last row instead of the normal data, so I created a subclass of NSTableView and overwrote the preparedCellAtColumn:row: method to generate the desired behaviour on the last row. - (NSCell *)preparedCellAtColumn:(NSInteger)column row:(NSInteger)row { if(row ...

NSArray objectAtIndex is not working. Please help

NSArray* address = [NSArray arrayWithArray:[detailItem addressArray]]; NSLog(@"address = %@", address); NSString* addressToString = @""; int arrayCount = [address count]; for (int i = 0; i < arrayCount; i++) { addressToString = [addressToString stringByAppendingString:[address objectAtIndex:i]]; if (i == arrayCount -1) { ...

Cocoa: Using an NSGradient as a mask for drawing below it

I am trying to draw a shape's reflection using Cocoa. I have already applied an NSAffineTransform and redrawn the shape successfully, but now I can't figure out how to draw an alpha mask over it. I'm using an NSCompositeDestinationOut operation, but it's giving me an unwanted result: I'm not exactly sure how to fix this - I need to make...

Cocoa Scalable Interface for Digital Signage Display

I'm working on a Cocoa application which will be used for a digital-signage/kiosk style display. I've never done anything like this with Cocoa before, but I'm trying to figure out what the best approach is for building the user interface for it. My main issue is that I need a way to have the user interface scaled up or down depending on...

How can I sense the user is holding down their finger on the screen without moving?

The best method I can think of is to start a timer in the touchesBegan event method. If the timer expires before the touchesEnded event arrives, then you know the user is holding down on the screen. If the touchesMoved event is called, then simply reset the timer so as to only detect holding down without movement. Is there any functi...

Tab Bar Controller + Navigation Controller + Bar Button Item

Within my MainWindow.xib I have a setup like I have here below. I have a Tab Bar Controller with a Navigation Controller within the Tab Bar Controller. I can switch between the different Navigation Controllers and this all works. What I am trying to do now is add a Right Bar Button Item to the Navigation Controller. I can't seem to us...

How to "break" out of dispatch_apply()?

Is there a way to simulate a break statement in a dispatch_apply() block? E.g., every Cocoa API I've seen dealing with enumerating blocks has a "stop" parameter: [array enumerateObjectsUsingBlock:^(id obj, NSUInteger i, BOOL *stop) { if ([obj isNotVeryNice]) { *stop = YES; // No more enumerating! } else { NSLog(...

Ellipsizing an NSMenuItem's title to the width of the menu

I want to programatically change an NSMenuItem's title, but ellipsize it so that this modification never causes the menu to increase in width. how can i do this? ...

NSMutableURLRequest: posting large amounts of data

I need to send large amounts of data (image files) by POST in a WebView, so I'm using NSMutableURLRequest with setHTTPBody:. Problem: if the data size is more than about 3MB, the app suddenly starts eating up huge amounts of memory and gets dog slow with all the paging. I've tried changing this: [request setHTTPBody:[NSData dataWithBy...

Enabling multitouch zoom in/out with UITextView

I have a TextView that's about the width and height of the screen and filled with text. How do I enable multi-touch zoom-in/out to make reading more user friendly? ...

Problem with Core Data, protocols, and readwrite vs. readonly property declarations

I'm running into an odd quirk involving Core Data, a declared protocol, and perhaps the LLVM 1.5 compiler. Here's the situation. I have a Core Data model that among others has two classes, IPContainer and IPEvent, with IPContainer being the parent entity of IPEvent. Each entity has a custom class in the project for it, created using m...

NSString get text between certain characters

If I have an NSString with something like this in it: Note Title Here:@:Note Description Here:@:123839:@:High Priority How can I separate out the strings between the ":@:" characters? I would know how many segments to expect if using something other than an array/for-loop would be easier. Thanks! ...

State of the art in MVC architecture?

Seems like there are a ton of possible MVC configurations/architectures (MVC, MVVM, MVP, HMVC, PAC, document-view...). Is there any currently accepted 'best' or state-of-the-art MVC architecture? What is the newest thinking? Or is it all a free-for-all and/or simply tied to whichever platform one develops on (e.g. MVVM for WPF)? (Specif...

compiler error on vec4 kernel routine

I am trying to include the following kernel routine into my Cocoa / objective C project. But I'm getting a compiler error when I build the project. The very first line is flagged with a syntax error saying "expected '=', ',', ';', 'asm' or 'attribute' before 'vec4'. Any ideas what this means and how to resolve it? As far as I can tel...

How to interpret a crash report ?

Hi all, I have got a crash report from one of my application's users, who found application to be freezing and then he has to force quit it. I am having trouble to extract information from it which can help me to resolve its cause. Can some one help me to interpret it or can give me some initial push so that I can interpret it my self?...

Detecting if the window is a key window in cocoa

I am making a application that the user will have to interact with one window and when they have that window configured the way they want it they switch to a different application then my application will begin to do other stuff which i will have defined in a method say for an example program when the main window has focus it contains a...

Copy NSView in cocoa / objective-c

I can't see any way to copy an NSView and create an identical NSView object. I see google hits about "use an NSData" but I don't understand that. ...

Flip coordinate system of an NSWindow objective-c / cocoa

How can I flip the coordinate system of an NSWindow? I know it has a Content View, but how can I flip the coordinate system of that specific View which is of type NSView? In a sub-view of my NSWindow's Content View I flip the coordinate system by subclassing NSView, placing that in my window, and in that subclassed NSView I implement me...

NSTableView with custom NSColumnHeaderCell

In my application I have an NSTableView with a custom header cell that is programatically assigned. The code to assign the custom cell looks like this: -(void)setupTableHeader:(id)table { NSArray *columns = [table tableColumns]; NSEnumerator *cols = [columns objectEnumerator]; NSTableColumn *col = nil; TRDarkTableColumnHea...

Passing objects from AppDelegate.m to View Controller

Hi I have an iphone application in which I am fetching & parsing data in in applicationDidFinishLaunching. Now I want to transfer this fetched data which is in one NSMutableArray to my first view controller to display it there. Whats the best way of doing this... ...