OC 의 두 가지 매 거 진 해석

1750 단어 Objective-C
          OC        .
NS_ENUM NS_OPTIONS
           .
     .

typedef NS_ENUM(NSInteger, UIViewAnimationTransition) {
    UIViewAnimationTransitionNone,
    UIViewAnimationTransitionFlipFromLeft,
    UIViewAnimationTransitionFlipFromRight,
    UIViewAnimationTransitionCurlUp,
    UIViewAnimationTransitionCurlDown,
};
typedef NS_OPTIONS(NSUInteger, UIViewAutoresizing) {
    UIViewAutoresizingNone                 = 0,
    UIViewAutoresizingFlexibleLeftMargin   = 1 << 0,
    UIViewAutoresizingFlexibleWidth        = 1 << 1,
    UIViewAutoresizingFlexibleRightMargin  = 1 << 2,
    UIViewAutoresizingFlexibleTopMargin    = 1 << 3,
    UIViewAutoresizingFlexibleHeight       = 1 << 4,
    UIViewAutoresizingFlexibleBottomMargin = 1 << 5
};
          .

NS_ENUM               . NS_OPTIONS           .

 UIViewAnimationTransition                 ,        ,       ,                      ,      ,  .

 UIViewAutosizing     .     view     View  ,  autoviewsizing           .UIViewAutoresizingFlexibleWidth  | UIViewAutoresizingFlexibleHeight
   ,      options       .

               view Autoresizing    .      ?

   .         .
   autoResizings = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleRightMargin;

    autoResizings    UIViewAutoresizingFlexibleLeftMargin      if(autoResizings & UIViewAutoresizingFlexibleLeftMargin)   true    .
        (    care NSUInteger      .        )
UIViewAutoresizingFlexibleLeftMargin = 00000001
UIViewAutoresizingFlexibleWidth = 00000010
UIViewAutoresizingFlexibleRightMargin = 00000100

          ,   autoResizings = 00000111.
             .

 00000111
&00000001   
    00000001, true.        .

좋은 웹페이지 즐겨찾기