Saturday, March 5, 2011
Don't retain UIColor, and don't release it
UIColor manages the lifetime of colors it returns. The caller is not supposed to retain it and release it.
Objective-C's protocol's property cannot be inherited
None of the Apple's Objective-C documents or programming guides that I have seen show an example of declaring a property in a protocol and the protocol is inherited. I declared a property in a protocol by Xcode fails to recognize the property.
Friday, February 25, 2011
Using an osg::ref_ptr for 'this' in the constructor is a bad idea
Inside a constructor, the reference count of 'this' is still zero. If you use a local osg::ref_ptr to reference 'this', the reference count will increment to one. However, when the constructor ends, the lifetime of the osg::ref_ptr also ends, and the reference count will become zero again, and 'this' will be destroyed.
Monday, February 21, 2011
Starting a QThread
We must create the QApplication (or QCoreApplication) object before we create a QThread.
Thursday, February 17, 2011
[NSArray objectEnumerator]
NSEnumerator * enumerator = [array objectEnumerator];
id arrayItem;
while (arrayItem = [enumerator nextObject]) {
// Do something about arrayItem
}
id arrayItem;
while (arrayItem = [enumerator nextObject]) {
// Do something about arrayItem
}
Subscribe to:
Posts (Atom)