Can anyone provide a sample / link to a sample Cocoa app that changes the 'hardware' cursor in a fullscreen OpenGL Cocoa app? I have been able to create a full screen GL app and an app that changes the cursor by overriding NSView::resetCursorRects but I have not been able to get both to work simultaneously. I've also refitted some of t...
Is there any reason why you shouldn't use the "-std=c99" flag for compiling Objective-C programs on Mac? The one feature in C99 that I really like is the ability to declare variables anywhere in code, rather than just at the top of methods, but does this flag causes any problems or create incompatibilities for iPhone or Cocoa apps?
...
I'm using NSURLConnection as listed below. I have three questions about this class. When I concatenate the url value, the debugger hits this line twice but not the line above it:
if (theConnection){
The second time I get EXC_BAD_ACCESS. Using the first url assignment (commented out) works fine.
1.) What's the difference?
- (void...
I need to run my game loop with very accurate timing. I am trying to use NSTimer to do this, and I am getting ok results, but there is a bit of drift.
When NSTimer fires does the next time event start counting when the handler finishes or does it start counting straight away.
If the former is it reasonable for me to use setFireDate to t...
I've got an column of cells in an NSTableView that get their text color from the app's preference plist. I want to set the text color to white when highlighted, but have been unable to figure out a good way to do this.
Anybody got any ideas?
...
What's the best way to center a label in a UIView? If you do something such as
UILabel *myLabel = [[UILabel alloc] initWithFrame:CGRectMake(view.frame.origin.x / 2, view.frame.origin.y / 2, 50.0, 50.0)];
Then you're setting the origin point of the label to the center of the view. The best bet would be to set the center of the view to ...
I am trying to come to grips with how difficult it is to use NSPopUpButton. It's by far and away the most difficult user element to program in Cocoa (at least as far as I am finding it).
The use case I have in mind is as follows:
I have a class called Port that represents a Serial port.
Amongst the attributes is a name field.
In the ...
Hi,
is there a way to automatically sync my Core Data Model with a server (preferably REST)?
Thanks
...
I'm looking to write a sample application speaking to a POP3/SMTP server. Instead of re-inventing the wheel with BSD sockets and CFNetwork type calls, I'm curious if there is currently any open source libraries that already take care of alot of the dirty work? I've tried Googling without much luck for anything.
Perhaps there's something...
I want to make an iPhone app, but I am planning to make the framework in C++. Is it possible to use things like templates in Objective-C++. I guess really the question is, can I use boost?
...
I have a simple protocol with a property:
@protocol StopsSource <NSObject>
@property (retain,readonly) NSArray * stops;
@end
I'm adding a key-value observer elsewhere to listen to changes to the "stops" property:
id<StopsSource> source = ...
[source addObserver:self
forKeyPath:@"stops"
options:NSKeyValueObserving...
I have declared a delegate for my cocoa application here :
MyAppDelegate.h
@interface MyAppDelegate : NSApplication {
}
- (void) applicationDidFinishLaunching:(NSNotification*) notice ;
@end
MyAppDelegate.m
@implementation MyAppDelegate
- (void) applicationDidFinishLaunching:(NSNotification*) notice {
NSLog(@"inside appdidfinis...
I am trying to create a cool score counter in my iPhone game, where I created the digits 0 to 9 in photoshop and I want to update the score every second.
What I am doing now is the following:
In my init I load all the digit sprites into an array, so that the array has 10 items.
I created a method which breaks down the current score (e...
I have a mutable array with contents I want to replace with NSNull objects.
This is what I do:
NSMutableArray* nulls = [NSMutableArray array];
for (NSInteger i = 0; i < myIndexes.count; i++)
[nulls addObject:[NSNull null]];
[stageMap replaceObjectsAtIndexes:myIndexes withObjects:nulls];
How can I do this more efficiently?
Is the...
Consider the following Cocoa/Obj-C code snippets:
MyClass *obj;
@try {
[obj doSomething];
}
@catch (NSException * e) {
NSLog(@"Exception occurred: %@", [e description]);
}
@finally {
[obj cleanUp];
}
and
MyClass *obj;
@try {
[obj doSomething];
}
@catch (NSException * e) {
NSLog(@"Exception occurred: %@", [e description]);
}
[obj...
For more info on fix this error, see here
I'm trying to make blackjack in objective C, and am having trouble passing objects around. My Hand class basically takes a deck and draws cards from it, adding them to an array.
Here's the Hand methods involved:
- (id)init : (Deck*) deck
{
[self draw: deck];
[self draw: deck];
retu...
How can I make my CIImage finite after an CIAffineTransform, so i can pass it to NSBitmapImageRep:initWithCIImage?
Overall I want to overlay two images via CIAdditionCompositing. Because one image is smaller then the other, it want to position it first. I thought transforming the smaller image is the right way to do this.
...
Hi,
I'm writing an iphone application with JSON and am trying to turn JSON strings into objects (NOT Dictionaries or Arrays).
In Java, thanks to Reflection, I can easily turn JSON into javabean instances like this:
import net.sf.json.JSONObject;
class MyBean {
private String property;
public String getProperty() { return prope...
I have a UITableViewController subclass that's instantiated, depending on where it's used, in a NIB or via code. In both cases I want to do customization in the initializer method. Does that mean I need to implement both initWithNibName:bundle: and initWithCoder:, and would each method call its respective super initializer?
While I do...
How do you capture an NSImage of the screen in Cocoa? I need to know the fastest way, because I'm trying to make a screencasting app.
...