<span id="Label3"></p> <ul> <li><li><p>Controller</p> <ul> <li>1. What is a controller: any class that inherits from Uiviewcontroller is called a controller</li> <li>2. The role of the Controller: manage UI interface (responsible for managing UI interface creation and handling of some events)</li> </ul></li></li> <li><li><p>Ibaction</p> <ul> <li>Connection method <ul> <li>1. Connect to "Storyboard" from "controller"</li> <li>2. Connect from "Storyboard" to "controller"</li> <li>3. Connect directly to the top of the interface on "Storyboard" in "Storyboard"</li> <li>4. Directly in the "Storyboard" to the "Storyboard" on the tool bar connection</li> <li>5. Do not define the method first, directly from "Storyboard" to "controller" connection</li> </ul></li> <li>Attention Points of Ibaction connection <ul> <li>1. Be careful when copying elements in storyboard</li> <li>2. The copy will be copied together with the previous Connection.</li> <li>3. A method can be associated with a number of controls</li> <li>4. A control can be wired in a variety of ways in development, usually not written like this</li> <li>5. If you delete the method associated with the button, a classic error will be reported after running reason: '-[viewcontroller redbtnclick]: unrecognized selector sent to instance 0x7fb4aa618e50 '</li> <li>6.IBAction can only be used as the return value of a method ibaction = = Viod</li> </ul></li> </ul></li></li> <li><p><p>UI Control Dimensions</p></p> <ul> <li><li>Most UI controls don't have a default size, so you can't see UIButton</li></li> <li><li>Frame <ul> <li>Frame is 0,0 in the Upper-left corner of the parent control</li> <li><pre><code class="lang-objc"><span class="hljs-built_in">UIButton *btn = [[<span class="hljs-built_in">UIButton alloc] init];btn<span class="hljs-variable">.frame = CGRectMake(<span class="hljs-number">100, <span class="hljs-number">100, <span class="hljs-number">100, <span class="hljs-number">100);</span></span></span></span></span></span></span></code></pre></li> </ul></li></li> <li><li>Bounds <ul> <li>Bounds is in its own upper left corner of 00, so generally set bounds x/y is invalid, the general situation uses bounds to modify the Size.</li> <li><pre><code class="lang-objc"><span class="hljs-built_in">UIButton *btn = [[<span class="hljs-built_in">UIButton alloc] init];btn<span class="hljs-variable">.bounds = CGRectMake(<span class="hljs-number">0, <span class="hljs-number">0, <span class="hljs-number">100, <span class="hljs-number">100);</span></span></span></span></span></span></span></code></pre></li> </ul></li></li> <li><li>Center <ul> <li>The center point is the intersection of the Control's width and height, and half the position of the width</li> <li>Use Center to modify the location in general</li> <li><pre><code class="lang-objc"><span class="hljs-built_in">UIButton *btn = [[<span class="hljs-built_in">UIButton alloc] init];btn<span class="hljs-variable">.center = CGPointMake(<span class="hljs-number">200, <span class="hljs-number">200);</span></span></span></span></span></code></pre></li> </ul></li></li> </ul></li> <li><li>Viewwithtag <ul> <li>Viewwithtag can only find child controls for the current control and the current control, cannot find sibling controls, or the parent control</li> <li>Lookup Order: 1. Find yourself First. 2. Find child controls 3. Find indirect child controls (grandson:)</li> <li>Use tag to get the value of the corresponding tag</li> </ul></li></li> </ul> <ul> <ul> <li>Anonymous categories <ul> <li>The difference between anonymous classification and classification <ul> <li>1. Anonymous classification has no name, category has a name</li> <li>2. Anonymous classification does not need to have the corresponding implementation, but the classification needs to have the corresponding implementation</li> <li>3. Anonymous classifications can declare properties or declare methods, and classifications can only declare methods</li> </ul></li> <li>Watch Out. <ul> <li>Properties and methods that are not exposed to the outside world are unloaded in the anonymous category after development</li> <li>Apple recommends that we write attributes in an anonymous category (extension/class Extensions)</li> </ul></li> </ul></li> </ul> </ul><p><p>IOS UI Basics 01</p></p></span>
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