You Are Here Home > Xcode

Xcode

Cocoa: Determining Size Of a NSTextView’s Content

You can do this:

[[textView layoutManager] usedRectForTextContainer:[textView textContainer]].size
Cocoa: Determining Size Of a NSTextView’s Content
Comments (0)   Filed under: Cocoa,Mac Programming,Objective-C,Xcode   Posted by: Codehead

iPhone: libpng error: CgBI: unknown critical chunk

If you get this error when trying your app on the device, you have PNG compression on in Xcode, in Xcode 4 goto “Build Settings” search for PNG in the search box and turn off PNG compression…

iPhone: libpng error: CgBI: unknown critical chunk
Comments (1)   Filed under: C Programming,iPhone SDK,Mac Programming,Xcode   Posted by: Hamid

Cocoa App Doesn’t Show Up In Activity Monitor

This was happening because I accidentally deleted “Bundle Display Name” from my info.plist…..

Cocoa App Doesn’t Show Up In Activity Monitor
Comments (0)   Filed under: Mac Programming,Objective-C,Xcode   Posted by: Hamid

Objective-C: A Function For Escaping Values Before Inserting Into SQLite

- (NSString *)escape:(NSObject *)value {
    if (value == nil)
        return nil;
    NSString *escapedValue = nil;
    if ([value isKindOfClass:[NSString class]] || [value isKindOfClass:[NSMutableString class]]) {
        NSString *valueString = (NSString *) value;
        char *theEscapedValue = sqlite3_mprintf("'%q'", [valueString UTF8String]);
        escapedValue = [NSString stringWithUTF8String:(const char *)theEscapedValue];
        sqlite3_free(theEscapedValue);
    } else
        escapedValue = [NSString stringWithFormat:@"%@", value];
    return escapedValue;
}
Objective-C: A Function For Escaping Values Before Inserting Into SQLite

Xcode: Embedding Lua In iPhone Apps

This is very simple, even though I can’t find so many resource regarding this online; follow these steps:

1- Download the latest version of Lua from: http://www.lua.org/ftp/

2- Obviously unpack it and find the “src” folder.

3- Delete the files: “lua.c”, “luac.c” and “print.c”

4- Grab the “src” file and drop it in your project’s left pane, under your projects’s name along with “Classes”, “Resources” etc.

5- Rename this newly added “src” to “lua”

Now you should be able to follow these types of tutorials:
http://www.ibm.com/developerworks/opensource/library/l-embed-lua/index.html

Hope this works for you!

Xcode: Embedding Lua In iPhone Apps
Comments (0)   Filed under: C Programming,iPhone SDK,Lua,Xcode   Posted by: Hamid