FAQs for new iOS users

Source: Internet
Author: User

 

Cause: the attributes associated with the storyboard are deleted, but the previously associated attributes are maintained in the storyboard.

Solution:

  

 

Solution: Check this

1. Click

 

2. It will be displayed

 

3. Select, which indicates that X appears when editing.

Effect:

 

I.

Cause of error: 1. The btnClick method is not implemented.

Solution 1: add this btnClick Method

Solution 2:

1. Click view controller.

2. Click the last button in the row.

3. will appear

4. No exclamation point found. It's the same as before. It's okay if x is used.

 

Note: The colon in OC is also part of the method name. Remember!

 

 

II.

 

 

Error cause: OC Syntax: Members of the structure attribute of an object cannot be directly modified.

_ Btn is an object

Frame is a struct.

The object and struct are different. The struct is in C language and can define many attributes, but cannot define methods. The object can define attributes and define methods, is a typical object-oriented syntax.

How to change the members of the struct attribute in an object:

Solution 1:

// Since the struct attribute member in the object cannot be directly modified // retrieve the struct CGRect frame = _ btn first. frame; // modify the structure frame. origin. y-= 10; // assign the modified struct value back to _ btn. frame = frame;

  

 

Solution 2:

// Obtain the y value CGFloat y = _ btn first. frame. origin. y; // modify y value y-= 10; // reset the y value of _ btn. Other attributes and _ btn remain unchanged _ btn. frame = CGRectMake (_ btn. frame. origin. x, y, _ btn. frame. size. width, _ btn. frame. size. height );

  

III.

Error cause: Point syntax cannot be used for id type

=*button = (UIButton *= button.tag;

 

 

 

Solution: uncheck this option.

 _btn.transform = CGAffineTransformMakeTranslation(, = CGAffineTransformMakeScale(, );

 

In this way, create a new transform and assign a value to the transform of the button. The second assignment will overwrite the previous assignment, so the expected effect will not be reached.

Solution:

 

 _btn.transform = CGAffineTransformMakeTranslation(,           _btn.transform = CGAffineTransformScale(_btn.transform, , );

 

 

 
                

 

Clear Saup

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.