Some deprecated problems encountered in the development of IOS7

Source: Internet
Author: User

Cell.textLabel.textAlignment = Uitextalignmentcenter;

Now we're going to write the cell. Textlabel. TextAlignment =nstextalignmentcenter;


UITableViewCell *cell = [[[UITableViewCell alloc] Initwithframe:cgrectzero Reuseidentifier:nil] autorelease];

Need to write

Static nsstring *tablesampleidentifier =@ "Tablesampleidentifier";

UITableViewCell *cell = [[UITableViewCellalloc] Initwithstyle:UITableViewCellStyleValue1reuseidentifier: tablesampleidentifier];


[self presentmodalviewcontroller: CalendarViewanimated: YES ];

change to [self presentviewcontroller: CalendarViewanimated:YES completion: ^{}];

The difference between the new interface is that it provides a parameter that allows you to pass in a block. This block 's callback method is called after the VC 's viewwilldisappear method. That is, the hidden VC object is freed after the callback is run.

The benefit of doing so is that it makes it easy to make connections and transitions between multiple UI effects.


The Pagecontrol control in IOS7

call [self. Subviewsobjectatindex: i]

Not Uiimageview, but UIView.

So the Updatedots method should be written like this:

-(void) updatedots{for        (int i = 0; i < [self.subviews count]; i++) {        uiview* dotview = [Self.subviews objectat INDEX:I];                if ([Dotview Iskindofclass:[uiimageview class]]) {            uiimageview* dot = (uiimageview*) Dotview;            if (i = = self.currentpage)                dot.image = _activeimage;            else                dot.image = _inactiveimage;        } else{            if (i = = self.currentpage)                [Dotview Setbackgroundcolor:[uicolor Colorwithpatternimage:_activeimage] ;            else                [Dotview setbackgroundcolor:[uicolor colorwithpatternimage:_inactiveimage];}        }           }

[Text drawatpoint: textpt withfont: [uifontsystemfontofsize: 14.0f ]]

Should be written in IOS7.

#define Nlsystemversiongreaterorequalthan (version) ([[[  Uidevice Currentdevice] systemversion] Floatvalue] >= Version)    #define Ios7_or_later   Nlsystemversiongreaterorequalthan (7.0)    if (ios7_or_later) {        uifont* font = [Uifont preferredfontfortextstyle:uifonttextstylebody];        Font = [Font fontwithsize:14.0f];        [Text Drawatpoint:textpt Withattributes:@{nsfontattributename:font}];    } else {        [text drawatpoint:textpt withfont:[uifont systemfontofsize:14.0f];    }




Related Article

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.