2015-4-14 Study notes: Contact management

Source: Internet
Author: User
Tags set background

One, add a new line

0. Remove the last child control

UIView *last = [Self.view.subviews lastobject];

New Y for this line = Last child control y + height of last child control

CGFloat rowy = last.frame.origin.y + lat.frame.size.height + 1; 1 for Line spacing

1. Create a row

UIView *rowview = [[UIView alloc] Initwithframe:cgrectmake (0, Rowy, 320, 50)];

* Equivalent to the following two lines

UIView *rowview = [[UIView alloc] init];

Rowview.frame = CGRectMake (0, Rowy, 320, 50);

Rowview.backgroundcolor = [Uicolor Redcolor]; Set Background color red

2. Add a row to the view in the controller

[Self.view Addsubview:rowview];

3. Make Delete Item valid

_removeitem.enabled = YES;

4. Performing animations

Rowview.frame = CGRectMake (Rowy, 320, 50);

Rowview.alpha = 0; Default transparency

4.1 Start animation

[UIView Beginanimations:nil Context:nil];

[UIView setanimationduration:1.0];

Rowview.frame = CGRectMake (0, Rowy, 320, 50);

Rowview.alpha = 1; Transparency changed to 1

[UIView commitanimations];

* Equivalent to the following animation block usage

[UIView animationwithduration:1.0 animation:∧{

Rowview.frame = CGRectMake (0, Rowy, 320, 50);

Rowview.alpha = 1; Transparency changed to 1

}];

Second, delete the last line

1. Remove the last child control

UIView *last = [Self.view.subviews lastobject];

Determines the property of the last class, which is toolbar return

Class C = [Uitoolbar class];

if ([last iskindofclass:c]) return;

2 Removing a child control

[Last Removefromsuperview];

[UIView animationwithduration:1.0 animations:∧{

CGRect Tempf = last.frame;

Tempf.origin.x = 320;

Last.frame = Tempf;

Last.alpha = 0;

} completion:∧ (BOOL finished) {

[Last Removefromsuperview];

_removeitem.enabled = Self.view.subviews.count >1;

}]

3. Determine the number of remaining child controls

if (Self.view.subviews.count = = 1)

{

_removeitem.enabled = No;

}

* Equivalent to the following line

_removeitem.enabled = Self.view.subviews.count >1;

2015-4-14 Study notes: Contact management

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.