Ios-ui Foundation-uiview and Uiviewcontroller

Source: Internet
Author: User

UIView is a container that can add other controls

View A is added to view B, A is a child view of B, and B is the parent view of a

Each viewcontroller will have a view property by default.

The controller is used to manage the view's life cycle: when to create and when to destroy

The controller is used to handle user interaction events (logic code to be written in the controller)

First Responder: Uitextfield, become the first responder automatically eject the keyboard

Fallback keyboard

Revoke First Responder identity

[Self.firstfield Resignfirstresponder];

Call the endediting of view:

[Self.view Endediting:yes];

List of issues

1. What is Ibaction Iboutlet

Iboutlet used to connect properties

Ibaction is used to connect methods with void

2. Why put attributes in a class extension

For security and encapsulation

3. Why use the weak property to decorate

Apple's official recommendation

If you use strong, you can run it properly.

Link Introduction

button when using the connection click Method, if you want to pass the parameter can only be button himself

Type

ID Default

UIButton * Making selections

Reason: ' [<viewcontroller 0x7f8aa071dc50> Setvalue:forundefinedkey:]: This class was not key value Coding-compliant For the key Tempbutton. '

After the connection, the attribute is deleted, but the connection is not canceled in SB

Reason: '-[viewcontroller clickButton2:]: Unrecognized selector sent to instance 0x7fbb8b925220 '

After associating a method with a button, the method is removed, and no connection is canceled in SB

A view can have multiple child view

A child view can have only one parent view

Common Properties of UIView

Subviews viewing the view's child view

Superview viewing the view's parent view

Removefromsuperview: Delete Child view from parent view

Addsubview: Adding a child view to a view

Ios-ui Foundation-uiview and Uiviewcontroller

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.