IOS (i) Introduction to basic controls and usage

Source: Internet
Author: User

The iOS interface is a lot easier to make than Android, although there are two ways to create layouts (code creation, layout files)

But the XML layout file in Android is also part of code creation in some ways, because each property that you use needs to remember the attribute name and then use the shortcut key to introduce it, such as @android: ... Way to export, if you do not know what method to use, in the design of the interface is difficult to achieve their desired results

and the iOS layout file, all the properties are in the Xcode property bar, just need to modify according to their own needs, you can

For example a basic textview:

2. Architecture Development with MVC

In Android such as layout file in res-layout code file in SRC, itself has a very good layering, we just need to according to their own needs of the. Java file code for subcontracting, for example: Build a Com.aaa.utils Package

iOS is a mix of all the files, so we need to create such a structure through the new group, but it is important to note that this directory structure is only available in Xcode, if you look directly at the folder location, there are no folders of these group

3. Click the response of the event and modify the contents of the control

In Android we want to control the touch event of a control, or modify the contents of a text

Required: 1.findViewById (View Id); Find based on the ID of the control

2. Use object Setonclicklistener (listener)//Get the control's Click event can of course also ontouch way

3. Use the corresponding example: TAG, ID, or member object to make a series of actions on the control

Cause: The IDs in all the XML layout files in Android are centrally managed in the R file, so to use the control you need to first retrieve the corresponding ID in the R file, and then the android underlying will find the corresponding object based on that ID.

In iOS, the view file is mapped with the code file (. h. m) through the controller's properties.

You can then create a response in a drag-and-drop fashion, and the button response to the way code is created is similar to that in Android

After the response relationship is established, there will be a black point indication in Xcode

The rest is the code writing problem, Android is based on the Java language, and iOS is based on the OC language, syntax is slightly different, but not very

In addition, a few small controls are explained briefly:

Text Receive box:

Using EditText in Android

Use text in iOS

Text display:

Using TextView in Android

Use label in iOS

As for the rest, it's pretty much the same, with detailed details, which will continue to be updated later.

For example, buttons all have ScrollView, TableView, etc.

Note: Referencing controls in your code in iOS requires a "UI" start

UIButton Uitextfield UIView ... Wait a minute

IOS (i) Introduction to basic controls and usage

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.