Warning: Backslash and Newline separated by space

Warning: Backslash and Newline separated by space

Solution: The backslash (\) character is used as the continuation character to continue #define statements and strings to the next line. GCC expects the backslash character to be the very last character on the line. This warning indicates that there is a space after the backslash. Delete the space and any other characters that come after the backslash.

Blogged with the Flock Browser

Converting an NSImage to grayscale


Blogged with the Flock Browser

Decoding a UTF-8 NSString

Create NSValue object that holds Integer value

An NSValue object is a simple container for a single C or Objective-C data item. It can hold any of the scalar types such as int, float, and char, as well as pointers, structures, and object ids. The purpose of this class is to allow items of such data types to be added to collections such as instances of NSArray and NSSet, which require their elements to be objects. NSValue objects are always immutable.

    NSValue* valObj;
    int theInt = 123;
    const void *myVal = &theInt;
    void *valPtr;
    valObj = [NSValue value:myVal withObjCType:@encode(int*)];

    [valObj getValue:&valPtr];

Blogged with the Flock Browser

Encryption for cocoa, cocoa touch

Using font panel in NSObject subclass

- (void)sharedFontPanel
    theFontPanel = [[NSFontManager sharedFontManager] fontPanel:YES];

- (void)awakeFromNib
    [[NSFontManager sharedFontManager] setDelegate:self];
    [self performSelectorOnMainThread:@selector(sharedFontPanel) withObject:nil
    [theFontPanel setDelegate:self];
    [theFontPanel setBecomesKeyOnlyIfNeeded:NO];

- (IBAction)ShowFontPanel:(id)sender
    [theFontPanel orderFront:sender];

- (void)changeFont:(id)sender

Blogged with the Flock Browser

Tags: , , , , , ,

How to get the current user name?

Cocoa :

C :
int userid = geteuid();
struct passwd *userst= getpwuid(userid);

Blogged with the Flock Browser

Tags: , , , , , ,

Posted in COcoa, MAc. 1 Comment »