UIButton

按鈕型別

按鈕的型別定義其基本外觀和行為。建立按鈕後,你無法更改其型別。最常用的按鈕型別是自定義和系統型別,但在適當時使用其他型別

  • UIButtonTypeCustom

    No button style.
    
  • UIButtonTypeSystem

    A system style button, such as those shown in navigation bars and toolbars.
    
  • UIButtonTypeDetailDisclosure

    A detail disclosure button.
    
  • UIButtonTypeInfoLight

    An information button that has a light background.
    
  • UIButtonTypeInfoDark

    An information button that has a dark background.
    
  • UIButtonTypeContactAdd

    A contact add button.
    

建立自定義按鈕(即自定義型別的按鈕)時,按鈕的框架最初設定為(0,0,0,0)。在將按鈕新增到介面之前,應將幀更新為更合適的值。