Some deprecated problems encountered during ios7 Development

Source: Internet
Author: User

Cell. textLabel. textAlignment = UITextAlignmentCenter;

Now we need to write cell. textLabel. textAlignment = NSTextAlignmentCenter;


UITableViewCell * cell = [[UITableViewCell alloc] initWithFrame: CGRectZero reuseIdentifier: nil] autorelease];

To be written

Static NSString * TableSampleIdentifier = @ "TableSampleIdentifier ";

UITableViewCell * cell = [[UITableViewCellalloc] initWithStyle: UITableViewCellStyleValue1reuseIdentifier: TableSampleIdentifier];


[SelfpresentModalViewController: calendarViewanimated: YES];

Change to [selfpresentViewController: calendarViewanimated: YEScompletion: ^ {}];

The difference between the new interface is that it provides a parameter that allows you to input a block. The callback method of this block is called after the viewWillDisappear method of VC. That is, run the callback after the hidden VC object is released.

Benefits of doing so: it facilitates the convergence and conversion between multiple UI effects.


PageControl control on IOS7

Call [self. subviewsobjectAtIndex: I]

The retrieved object is not a UIImageView, but a UIView.

Therefore, the updateDots method should be written as follows:

-(void) updateDots{        for (int i = 0; i < [self.subviews count]; i++) {        UIView* dotView = [self.subviews objectAtIndex: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]

Write 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]];    }




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.