What Cocoa/Core Foundation helper functions do you wish you knew about 2 years ago?

前端 未结 7 1173
自闭症患者
自闭症患者 2021-01-31 00:20

I just discovered the NSRect helper functions in NSGeometry.h (i.e. NSMidX, NSMaxX, etc...)

These would have made some repetitive coding much easier. I knew about NSMak

7条回答
  •  Happy的楠姐
    2021-01-31 01:06

    This is a shortcut instead of a library call that I missed, but it is in the spirit of the thread.

    One shortcut that I use alot is using an inline format statement in NSLog calls.

    
    NSLog(@"x=%@", [someobject className]);
    

    instead of the more verbose

    
    NSLog([NSString stringWithFormat:@"x=%@", [someobject classname]]);
    

提交回复
热议问题