¡@

Home 

2014/10/15 ¤U¤È 10:04:35

iphone Programming Glossary: bitmask

How do those bitmasks actually work?

http://stackoverflow.com/questions/2555101/how-do-those-bitmasks-actually-work

do those bitmasks actually work For example this method from NSCalendar takes a bitmask NSDate dateByAddingComponents NSDateComponents comps.. do those bitmasks actually work For example this method from NSCalendar takes a bitmask NSDate dateByAddingComponents NSDateComponents comps toDate NSDate date options NSUInteger opts So options can be like NSUInteger.. they pull out those values which are merged into options If I wanted to program something like this that can take a bitmask how would that look iphone objective c cocoa cocoa touch share improve this question To do this you want to bitwise..

Just two rounded corners? [duplicate]

http://stackoverflow.com/questions/4845211/just-two-rounded-corners

CGContextAddLineToPoint context rect.origin.x rect.origin.y radius CGContextClosePath context This takes a bitmask I called it UIImageRoundedCorner because I was doing this for images but you can call it whatever and then builds up a path.. easy to adapt it. You're basically just building up a path and then clipping the context to it. Edit To explain the bitmask part it's just an enum typedef enum UIImageRoundedCornerTopLeft 1 UIImageRoundedCornerTopRight 1 1 UIImageRoundedCornerBottomRight.. 1 2 UIImageRoundedCornerBottomLeft 1 3 UIImageRoundedCorner In this way you can OR things together to form a bitmask that identifies corners since each member of the enum represents a different power of two in the bitmask. Much Later Edit..