I have a NIB which contains two windows, one is the app's main window visible at launch and the other is a custom sheet (and therefore not visible at launch). When the sheet is required my controller calls:
[NSApp beginSheet: sheetWindow modalForWindow: mainWindow modalDelegate: self didEndSelector: @selector(didEndSheet:returnCode:cont...
Hi,
how do I extract all attachments from an IMAP message? I use Objective-C and Cocoa, but are happy for generic tutorials, code or hints, too.
Regards
...
I understand you need to be careful with autorelease on the iPhone. I have a method that is returning a class it allocs which is needed by the caller so in this situation as I understand it, I need to send autorelease to the object in the callee before it returns.
This is fine, but once control returns to the phone (i.e. after my button...
How do I make Apple's Cocoa GUI controls not automatically "flip" lines that contain right-to-left text (such as arabic)?
Behold my test case, wherein I plan to keep the asterisks (**) in the beginning of the lines when they are printed on screen:
#import <Foundation/Foundation.h>
int main(int argc, char *argv[])
{
NSAutoreleasePo...
I'm trying to diagnose a problem in UKSyntaxColoredTextDocument 0.4 http://www.zathras.de/angelweb/blog-uksctd-oh-four.htm where text that actually lives in a different font than the one you have specified disappears as you type. (You can download and try out this cool utility to see this problem for yourself...)
Here's the background:...
NSData *data;
data = [self fillInSomeStrangeBytes];
My question is now how I can write this data on the easiest way to an file.
(I've already an NSURL file://localhost/Users/Coding/Library/Application%20Support/App/file.strangebytes)
...
I'm trying out some MacOS programming and having some trouble understanding how bindings work with an NSPopupButton. I'm interested in binding to an NSDictionaryController (I don't think I need an intermediate NSArrayController but if that is the best way, I'm open to it).
I've created a controller object that has a property 'db' which...
I have a table view controller that makes an http request, which returns xml. I parse the xml and display it in a UITableView. The first time the http request is called everything works as expected. The second time I call the http request: I receive the xml as expected, but the table does not update. I am calling the reloadData metho...
I have been seeing some code around that resembles the following:
@protocol MyProtocol <NSObject>
// write some methods.
@end
Is there any particular reason why MyProtocol conforms to the NSObject protocol? Isn't that rather redundant in that if you do something such as:
id foo; // foo here conforms to NSObject AND MyProtocol?
Just...
I have an NSView subclass which implements acceptsFirstResponder, resignFirstResponder and becomeFirstResponder. It also implements the following method:
-(void)keyDown:(NSEvent *) event
{
[self interpretKeyEvents:[NSArray arrayWithObject:event]];
}
I handle the messages that interpertKeyEvent: sends in an appController class (Th...
This is a Cocoa n00b question - I've been programming GUI applications for years in other environments, but now I would like to understand what is "idiomatic Cocoa" for the following trivialized situation:
I have a simple custom NSView that allows the user to draw simple shapes within it. Its drawRect implementation is like this:
- (vo...
Hi all,
I'm banging my head here trying to figure out why there is a three to four second overheard for when an NSURLConnection object is created with a POST based NSMutableURLRequest. The overhead which I speak of, is after an NSURLConnection gets fired off, watching Apache access logs, I see the request come in substantially longer af...
I'm using a Table View in a Cocoa application. I have set the double click action to do the following method when it occurs:
- (void)doubleClickInTable:(id)sender {
int rowIndex = [sender selectedRow];
if (rowIndex != -1) {
[userEditController setData:[[self users] objectAtIndex:rowIndex]];
[self showUserEdit...
I want to open a panel when the user clicks on a text field. I think I should use a delegate method that responds to the click event. I found that the
(void)textDidBeginEditing:(NSNotification *)aNotification
method does not work, and that the
(void)controlTextDidBeginEditing:(NSNotification *)aNotification
method works, but only...
I'm trying to figure out how to create a view that, depending on the circumstances, has a variable number of items being displayed in it. Something like the grid view in Finder or iTunes, an image with a sort of caption text underneath it. I've heard that you can use an NSCollectionView for this sort of thing, but I don't really know. I'...
I would like to show the user a splash screen (a picture) while my Cocoa-based application launches. How would this be possible?
...
To clarify, I want to check for valid characters. For first name, last name I want to check for [A-Za-z]. For Email I want to check for chars valid for email.
What algorithm would I use to CHECK user input? Specifically, I'd like to CHECK the user's first name, last name and email address for valid characters before I add to database.
...
Some context: I'm trying to clean up some of my FMDB code. My one table has a lot of columns and the method in FMDB I need to use is one that expects a variable number of arguments, similar to NSString's class method +stringWithFormat:.
An example:
[db executeUpdate:@"insert into test (a, b, c, d, e) values (?, ?, ?, ?, ?)" ,
@"hi'", /...
I'm looking into building an application which works just as well offline as it does online. Since the application cannot communicate with the server while in offline, there is some level of synchronization which needs to take place.
What are some good tools to read about and start thinking about when planning offline operations with sy...
I'm developing on the iPhone and I'm missing something about storing objects in an NSMutableArray - what am I doing wrong and how should I approach this?
The relevant sections of the code are
I have an object, Entity, defined which inherits directly from NSObject. In my class GLView I wish to define an array of these - so GLView.h
@...