I did this in awakeFromNib:
drawLayer = [CALayer layer];
self.layer = drawLayer;
[self setWantsLayer:YES];
there is a "add:" action
// some business logic
[drawLayer addSublayer:layer];
[self layout];
-(void)layout
while(pg = [pageEnumr nextObject])
{
//rect is calculated so that layers are added in order (left to...
So I have two objects, Invoice and InvoiceLineItem. InvoiceLineItem has a property called cost and it is dynamically created based on other properties. To help with the KVO/bindings I use:
+ (NSSet *)keyPathsForValuesAffectingCost {
return [NSSet setWithObjects:@"lineItemType", @"serviceCost", @"hourlyRate", @"timeInSeconds", @"prod...
Is it possible to navigate an NSTableView's editable cell around the NSTableView using arrow keys and enter/tab? For example, I want to make it feel more like a spreadsheet.
The users of this application are expected to edit quite a lot of cells (but not all of them), and I think it would be easier to do so if they didn't have to double...
Now I drag a file to the app icon in the dock, this app is based on document . I found that no little image on the left of window title after the app is run and the mainwindow is open . but when I drag a file to the dock icon before the app run and use this method to run the app , a little image on the left of window title to show the fi...
Hi, I have got a problem with NSString.
NSString* str = [[NSString alloc] initWithString:@"Hello world"];
In the code above, do I need to release the object str? According to the rule, this object is created with alloc, so it should be explicitly released with the release method. However, I can't find any memory leaks in Instruments ...
I am building a string in Cocoa to be used as a SQL statement which will be passed into the FMDB wrappers for sqlite; however, the database craps out with a BAD_ACCESS failure. I have the following code:
prefix = @"SELECT * FROM Table WHERE Field1 LIKE '%";
middle = @"%' OR Field2 LIKE '%";
suffix = @"%' ORDERY BY ";
orderby = @"%' ...
I'm working on internationalizing an iPhone application, and I'm using ibtool to extract the string from my xib files so they can be translated by a localization house like so:
ibtool --generate-strings-file BlahBlahView.strings English.lproj/BlahBlahView.xib
The problem with this is that the .strings file I end up with contains all t...
I need color indicators. Need to be able to do green, yellow and red. Anybody know how? I looked through the available icons/etc in Interface Builder but did not see anything like them.
Like this:
...
I followed Chris Hanson's advice about debugging framework unit tests in Xcode 3.1, but when trying to run the custom executable, the program crashes, stating the below error message [substituted $(BUILD_PRODUCTS_DIR) for the real location of the build products].
2009-03-02 19:56:03.414 otest[28059:10b] Error loading
$(BUILD_PRODU...
Hi,
I have to search mp3 files in all directories. I implement using Spotlight concept, but it searches only in /user/userAccount/Music/Itunes Music. I have stored my songs on Desktop/Songs/*.mp3 and it doesn't search in this directory.
What should i do that my apps will search in all directories.
Thanks.
Haresh.
...
I need my application to open a window when a user double clicks on a row in an NSTableView. I'm having a bit of a difficult time finding information or examples on how to accomplish this. Can anybody point me in the right direction?
...
I want to make a preference for hiding the Dock icon and showing an NSStatusItem.
I can create the StatusItem but I don't know how to remove the icon from Dock. :-/
Any ideas?
...
I'm new with the whole QTKit and I was looking for some feedback on the following code that I am attempting to use to display the camera's image and record movies.
- (void)initializeMovie {
NSLog(@"Hi!");
QTCaptureSession* mainSession = [[QTCaptureSession alloc] init];
QTCaptureDevice* deviceVideo = [QTCaptureDevice defaultInputDevi...
I don't plan to write applications without IB, I'm just in the process of trying to learn more about programming.
How can I get a single instance of my AppController class at startup? (It's normally loaded from the nib.) And can you clear up the use of +initialize and -init? If I understand, +initialize is called on all classes at sta...
Some applications have a check button for "start at login"...
How would you implement this?
...
I know how to write a Cocoa project, with classes, xib files, localizations, property lists, resources, ...
Sometimes, when I want to learn a specific API or a how-to for a cool feature, apple reference manuals or programming guides point to examples to download.
And sometimes, I feel lost digging in all this source code and not findin...
You all know the menu bar (or better said NSStatusBar) in Mac OS X.
There are some items which I can move and other which not.
I would like to be able to drag the NSStatusItem of my app.
Any idea how to implement this?
...
So I've just started digging into Objective-C, Cocoa, and iPhone development. I've ran into a little weird thing which I don't really get tho.
I'm trying to get process information, process name works fine, but things get weird when I try to also get the process ID.
Here's the piece of code I have, which evidently doesn't output anythi...
I'm doing a short project just to experiment writing without the use of nib files (personal interest only, don't plan on never using nibs!).
I have my app controller set up as NSApp's delegate. Under -(void)applicationDidFinishLaunching:(NSNotification *)aNotification, I attempt to initialize the interface.
AppController.h:
#import <C...
Hello all,
I'm an iPhone dev newbie, and I'm running into a problem figuring out how much of an UIView I'm able to use when the UIViews's controller is part of an UITabController. I'm initializing the window as
window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
and the view as
myView = [[UIView alloc] initWith...