Skip to content

Instantly share code, notes, and snippets.

@Kentzo
Created August 10, 2011 13:39
Show Gist options
  • Select an option

  • Save Kentzo/1136818 to your computer and use it in GitHub Desktop.

Select an option

Save Kentzo/1136818 to your computer and use it in GitHub Desktop.
Hints for a Mac OS X Developer

###NS*Cell + *Template.imgext = system-like drawing of the image

###Switching GPU on new MacBooks on Lion. http://developer.apple.com/library/mac/#qa/qa1734/_index.html

###currentSystemPresentationOptions and NSApplicationPresentationFullScreen Doesn't work.

###NSTextList You have to manually format string to create list. http://stackoverflow.com/questions/6641235/is-it-possible-to-draw-strings-with-custom-paragraph-styles-in-catextlayer

###CIFilter for NSWindow http://www.cocoabuilder.com/archive/cocoa/216661-semi-transparent-blurred-nswindow-background.html

###Window level of desktop elements on Lion On Lion window level of desktop elements is kCGDesktopWindowLevel + 21.

###NS_REQUIRES_NIL_TERMINATION Adds an additional check to invocations of those methods to make sure the nil has been included at the end of the argument list

###NSWindowDelegate Don't update window's frame in -windowDidChangeScreen: or by processing NSWindowDidChangeScreenNotification

###CIImage drawing performance [CIImage draw…] methods does not draw until screen updates are enabled or forced by system. (NSDisableScreenUpdates/NSEnableScreenUpdates and disableScreenUpdatesUntilFlush)

###-[CalCalendar color] can return nil or NULL. To fix this problem, ask your user to clean iCal's cache http://kb.mit.edu/confluence/pages/viewpage.action?pageId=12386508

Some iCal issues may be resolved by removing the iCal account, quitting and restarting iCal, then re-adding the iCal account. It may also be useful to clear the iCal cache.

Quit iCal.

  1. Make BACKUP copies of these files before deleting them.
  2. Delete the calendar cache found here:
  3. ~users/your user/Library/Calendars/Calendar Cache
  4. ~/Library/Caches/com.apple.iCal (if these files exist)

If there are more issues with removing events, the following may also be useful:

Quit iCal.

  1. Make BACKUP copies of these files before deleting them.
  2. Delete the Events directory found here:
  3. ~users/your user/Library/Calendars/*.calendar/Events

new mail sound property of Mail.app is broken in the version 1251.

###Get name of class in Lion: /* Uncomment for LP32 / / typedef long ptr_t; / / Uncomment for LP64 */ typedef long long ptr_t; // assuming that arg0 is an object this->result_ptr = arg0->isa; this->result_ptr = (ptr_t)(this->result_ptr + 32); this->result_ptr = (ptr_t)(this->result_ptr + 8); this->result_ptr = (ptr_t)(this->result_ptr + 24); this->result = copyinstr(this->result_ptr);

###No output when ctrl-c in terminal Short: enable root, use su root then dtrace (instead of sudo dtrace). Long: http://www.mail-archive.com/freebsd-hackers@freebsd.org/msg158848.html

###Get return value of method You cannot

###Builtin frame (bounds + position) animation (10.7.0) isn't synchronized. E.g. original frame is (0, 0, 100, 100) and you extended it to (0, 0, 100, 200). While animating, bottom is been changing.

How geometryFlipped of CALayer affects Quartz coordinate system for drawing shadow on Lion and SL.

On SL, coordinate system doesn't depend on geometryFlipped (that is, shadow will be always upward). However on Lion it depends on it (that is when geometryFlipped set to NO, it's upward, otherwise it's downward).

Animate properties of layers added within explicit CATransaction block.

Assume you create and inserte a layer and then set its properties to initial. If you want to add animation, you MUST specify fromValue. Make sure you don't use properties of presentationLayer.

@konstpavlone

Copy link
Copy Markdown

Don't update window's frame in -windowDidChangeScreen: or by processing NSWindowDidChangeScreenNotification

Would you please explain why this shouldn't be done?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment