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

how to make a programmatic breakpoint?

Posted in MAc. Tags: . Leave a Comment »

How do I determine if I’m being run under the debugger?

Technical Q&A QA1361
Detecting the Debugger

http://developer.apple.com/qa/qa2004/qa1361.html

Blogged with the Flock Browser
Posted in MAc. Tags: . Leave a Comment »

Cocoa Views in Carbon Windows

HICocoaView

Cocoa provides views that are either not currently available in HIToolbox or are available without full support. These include views such as WebView, PDFView, QTMovieView, and NSTokenField. In addition, the Cocoa and Carbon control hierarchies are incompatible, so it has been difficult or impossible to have views from both frameworks embedded within the same window.

A new type of HIView called HICocoaView provides a general solution to these problems. You can embed a Cocoa view (any subclass of NSView) inside the HIView control hierarchy of a Carbon window. This is accomplished by associating the Cocoa view with a Carbon wrapper view called HICocoaView, a subclass of HIView. You can use standard HIView functions to manipulate the wrapper view, and you can use Cocoa methods to manipulate the associated Cocoa view. HICocoaView is supported only in compositing windows.

HICocoaView is available in Mac OS X v10.5 and later. For more information, see Carbon-Cocoa Integration Guide.

Blogged with the Flock Browser

Increase the text font size in XCode documentation window

Go to Documentation tab of X-Code preferences.

Change the value of Never use font sizes smaller than drop down of Universal Access section to desired font size.

Blogged with the Flock Browser

Change Company Name in Xcode

Cited from: http://macdevelopertips.com/xcode/change-company-name-in-xcode.html

By default, Xcode inserts a company name something similar to the following in all new source files (.m .h etc):

    Copyright (c) 2009 MyCompanyName. All rights reserved.

Changing this reference is as simple as entering the following from within a terminal window, replacing “YourNameHere” with the text you prefer. Also, make sure this is all entered on one line in the terminal

defaults write com.apple.Xcode PBXCustomTemplateMacroDefinitions
    ‘{“ORGANIZATIONNAME”=”YourNameHere”;}’

Otherwise you can also set the company name in your me card in Address Book.

Blogged with the Flock Browser