Ios UI Basics 02

Source: Internet
Author: User

  • UIView
    • Controls that inherit from UIView can add child controls
    • Property
      • Superview
        • Who calls Superview, then gets the parent control of WHO
      • Subviews
        • Subviews is used to get all the child controls
        • Who calls Subviews, then is the child control who gets it
    • Method
      • Removefromsuperview
        • Removed from the parent control, who is called to remove who
      • Addsubview
        • Add to parent control, who calls to add child controls to WHO
  • UILabel
    • Text Control inheritance UIView
    • Property
      @property(nonatomic) NSInteger numberOfLines;行数
      @property(nonatomic)        NSTextAlignment    textAlignment; 文本位置调节默认在左
  • Uiimageview

    • Property:

        • Contentmode

          • Uiviewcontentmode content:
          • 1.UIViewContentModeScaleToFill,

            • The picture is stretched according to the aspect ratio of the uiimageview.
            • Until the entire picture is filled with uiimageview.
            • Because it is stretched according to the aspect ratio of the uiimageview, the picture will deform
          • 2.UIViewContentModeScaleAspectFit,

            • is stretched according to the aspect ratio of the picture.
            • Require the entire picture to be within the range of Uiimageview
            • and width and height one must be as centered as Uiimageview
          • 3.UIViewContentModeScaleAspectFill,
            • is stretched according to the aspect ratio of the picture.
            • Require the entire picture to be filled Uiimageview
            • and the width or height of the picture, one of which must be the same as Uiimageview.
        • @property (nonatomic,copy) Nsarray *animationimages;
          • Accept an array of animated images
        • @property (nonatomic) Nstimeinterval animationduration;
          • Animation Execution Time
        • @property (nonatomic) Nsinteger Animationrepeatcount;
          • Number of repetitions
    • Method
      • Initwithimage: (UIImage *) image; Initialize Uiimageview
      • startanimating; Start animation
      • stopanimating; End Animation
  • Note:
    • if it is through [[Uiimageview alloc] init]; the created picture does not have the default width height
    • But if it is through [[Uiimageview alloc] Initwithimage:im Age]; Create a picture that has the default width height default width height is the width height of the picture the
    • OC syntax, cannot directly modify the "object" of the "struct property" of the "member" if you cannot directly modify the "object" of the "struct property" of the "member", then if you really want to change what to do?
      • Remove-and-modify-re-assign
         iv.frame.size = Image.size; CGRect tempframe = Iv.frame;tempframe.size = Image.size;iv.frame = tempframe;       
  • Supporting files and Assets.xcassets

    • Difference
    • Images can be placed in the Assets.xcassets folder in addition to the supporting files.
      > 如果是放到supporting files中, 使用图片的时候需要加片的后缀> 常用图片可以放在supporting files,加载完会释放掉> 如果是放到Assets.xcassets中, 使用图片的时候不需要加片的后缀> 如果是放到Assets.xcassets中, 那么系统会自动对图片进行copy操作> 如果是放到Assets.xcassets中, 可以对图片进行一些额外的属性设置> 如果是放到Assets.xcassets中, 可以提高软件的安全性, 它会将图片都加密压缩保存到Assets.car文件中,> 不常用图片可以放在Assets.xcassets,加载后不释放占用内存
  • Uicontrol

    • The control that inherits UIView inherits Uicontrol to add the listener can use:
      • -(void) AddTarget: (ID) Target action: (SEL) Action forcontrolevents: (uicontrolevents) controlevents;
        • Target: Who listens to the button
        • Action: The method to be executed after the supervisor hears
        • Events: Type of Event
  • UIButton
    • Inherit Uicontrol
    • Method
      • Buttonwithtype Setting button types
      • In general, the contents of the button settings are setxxx such as Settitle,settitlecolor,setimage,setbackgroundimage

Ios UI Basics 02

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.