Ui Study Notes-Day 1

Source: Internet
Author: User

I. iOS Overview

IOS is the mobile operating system of apple? It is used for mobile products such as iPhone, iPad, iPad Mini, and iPod Touch.

With iOS, we can develop video, meitu, news, and ,? Music, group buying, e-commerce, reading, and picking? Row class ,? What are lifestyle services and games? Application.

In addition, IOS can also communicate with external devices to develop more changes? Active products ,? Such as: Smart Home (iOS app Control TV, air conditioning, etc.), Jian? Products (intuitively display the health status of the human body through the APP.

Ii. UI Overview

UI (User Interface ):? User Interface ,? Users can see a variety? Surface Element.

IOS app = Various UI controls + business logic and algorithms.

Want to develop? An exquisite response? Program, you need to be familiar with the use of various UI controls.

3. uiwindow

A window is a window. Every app needs to use a window to display the content to users.

In iOS, The uiwindow class is used to represent a window. Generally, an application creates only one uiwindow object.

Because the main function of window is to present content to users, we will not perform too many operations on the window.

Iv. uiview

View: A rectangle area on the screen. In iOS, uiview is used to represent the view.

Different controls represent different types of views

All the content that can be viewed in IOS is view or its subclass.

// @ Property (retain, nonatomic) uiwindow * window; // The default value of arc is strong MRC and retain // appdelegate. code # import "appdelegate. H "@ implementation appdelegate-(void) dealloc {[_ window release]; [Super dealloc];}-(bool) Application :( uiapplication *) Application didfinishlaunchingwitexceptions :( nsdictionary *) launchoptions {self. window = [[[uiwindow alloc] initwithframe: [[uiscreen mainscreen] bounds] autorelease]; // override point for customization after application launch. self. window. backgroundcolor = [uicolor whitecolor]; // The first step is to create a view. // The default view is clearcolor uiview * redview = [[uiview alloc] initwithframe: cgrectmake (100,100,100,100)]. // Step 2: configure the view // [redview setbackgroundcolor: [uicolor redcolor]; // you can set the redview color in two ways. backgroundcolor = [uicolor redcolor]; // Step 3: add the view [self. window addsubview: redview]; // [_ window addsubview: redview]; // Add two methods // Step 4: Memory Management [redview release]; [self. window makekeyandvisible]; return yes ;}
The UI uses the uikit framework and uiview in four categories.

How to present a content

You can respond to touch events for animated painting. The steps for creating a view by graffiti are as follows :? 1. Open up the space and initialize the view (the view location and size are given during initialization )? 2. View? Some settings (? Such as: background color )? 3. Add the view to the window for display. 4. Release the view object. 1. arc --> mrc2.strong --> retain3.dealloc4. adding autoreleaseframeframe is an important attribute of the view and the key to the view layout. It determines the size and position of the view, ceter (Central Point) center. X = frame. X + frame. width/2; // The X coordinate center of the center. y = frame. Y + frame. height/2 // The Y coordinate boundsbounds (bounds) of the center is also an important attribute of the view. It is used to define its own boundary, it is a cgrect struct variable like frame. When a view is set to bounds, it regards itself as a container, define the boundary size and the offset relative to the coordinate origin. When the subview is added to this view, the framecenter change bounds will be calculated based on the Origin specified by bounds. origin unchanged bounds. when orgin changes, the center does not change the value of adding an important attribute to the view management view level view. uilabeluilabel (Label): controls that display text appear frequently in apps. uilabel is a subclass of uiview. uilabel is a view text display that can display text.
Uilabel * aview = [[uilabel alloc] initwithframe: cgrectmake (30, 30,100,100]; // aview. backgroundcolor = [uicolor redcolor]; aview. TEXT = @ "username:"; [_ window addsubview: aview]; [aview release];

Control text display

6. uitextfield

Uitextfield? Box): control? This input and display controls. Uitextfield in app

The frequency is also relatively high.

IOS uses a virtual keyboard for input. When you click the input box, the system will? Call up the keyboard ,? Then you enter? Step by step. When you do not need to enter it, can you make it? Use the keyboard revocation method to retrieve the pop-up

Keyboard. What are the main features of uilabel compared with uilabel in uitextfield? Used for text display and cannot be edited,

What is uitextfield allowed? User editing text (input ).

Uitextfield * bview = [[uitextfield alloc] initwithframe: cgrectmake (30, 30,100,100)]; bview. borderstyle = uitextborderstyleroundedrect; // rounded border bview. placeholder = @ "Enter your username"; // The input box prompts [_ window addsubview: bview]; [bview release];

Text display

Input control

Appearance Control

VII. uibutton

Creating uibutton is similar to creating uilabel, uitextfield, and uiview .?

1. Create a button object (if this class has initialization? Method, make ?? Your own; otherwise, make? Parent class ).?

2. Set button display? Related attributes?

3. Add a click event for the button?

4. Add the button? View ,? To display?

5. buttons do not need to be released (because the buttons created by class methods are used)

 

Uibutton * loginbutton = [uibutton buttonwithtype: uibuttontypesystem]; loginbutton. frame = cgrectmake (30,200, 60, 30); [loginbutton settitle: @ "login" forstate: uicontrolstatenormal]; [loginbutton addtarget: Self action: @ selector (LOGIN :) forcontrolevents: uicontroleventtouchupinside]; [containerview addsubview: loginbutton];

 

Uibytton add event

Appearance Control

 

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.