iOS Development Basics-Fragmentation 34

Source: Internet
Author: User

1: Third-party plugin Skstableview in IOS7.1.1

Workaround, modify its internal source code:

Class= objc_getassociatedobject (Indexpath, subrowobjectkey); return [Subrowobj IntegerValue];} (void=class];objc_setassociatedobject (Indexpath, Subrowobjectkey, Subrowobj, objc_association_retain_nonatomic);}

2:uitableviewcell attribute highlighted, selected difference

Customize a cell to inherit from UITableViewCell, and then overload it with the following two methods:

-(void) sethighlighted: (BOOL) highlighted animated: (bool) animated;

-(void) setselected: (BOOL) selected animated: (bool) animated;

One of the two methods is to set the cell's highlight state, and the other is to set the cell's selected state. When we click on the cell, the first is to set the cell's highlight state to Yes, then let go of the cell when the highlight state is set to No, then set the cell to the selected state is yes, and finally to call delegate in the TableView: Didselectrowatindexpath: Method.

This shows: cell highlighting state is not durable, that is, when the tap will become highlighted, let go of the time will be automatically set to non-highlighted state. The selected state of the cell is persistent and we do not trigger it to change state, then the selected state will not be

The following examples are animated with pop (with a corresponding animation effect when selected and released):

- (void) setselected: (BOOL) selected animated: (bool) animated {[Super setselected:selected animated:animated];}- (void) sethighlighted: (BOOL) highlighted animated: (BOOL) animated{[Super sethighlighted:highlighted animated:animated    ]; if(self.highlighted) {popbasicanimation*scaleanimation =[Popbasicanimation animationwithpropertynamed:kpopviewscalexy]; Scaleanimation.duration=0.1; Scaleanimation.tovalue= [Nsvalue Valuewithcgpoint:cgpointmake (1,1)]; [Self.textlabel pop_addanimation:scaleanimation Forkey:@"Scalingup"]; } Else{popspringanimation*sprintanimation =[Popspringanimation animationwithpropertynamed:kpopviewscalexy]; Sprintanimation.tovalue= [Nsvalue Valuewithcgpoint:cgpointmake (0.9,0.9)]; Sprintanimation.velocity= [Nsvalue Valuewithcgpoint:cgpointmake (2,2)]; Sprintanimation.springbounciness= -. F; [Self.textlabel pop_addanimation:sprintanimation Forkey:@"springanimation"]; }}

3:uiwebview Black Edge solution at bottom of IOS9

UIWebView the bottom of the black bar is very difficult to see (under IOS8 will not, in the IOS9 will appear), especially at the bottom of the transparent control, the practice is very simple, only need to set the opaque to no, the background color is set to Clearcolor

Application of Setedgesforextendedlayout in 4:uiviewcontrol

In iOS 7, Apple introduced a new property called [Uiviewcontroller Setedgesforextendedlayout:], which has a default value of Uirectedgeall. When your container is a navigation controller, the default layout starts at the top of the navigation bar. That's why all UI elements are drifting up to 44pt.

-(void) viewdidload{    [Super Viewdidload];     // let the screen start counting (0,0)    from the navigation bar if ([Self respondstoselector: @selector (setedgesforextendedlayout:)]) {        = uirectedgenone;    }}

iOS Development Basics-Fragmentation 34

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.