zoukankan      html  css  js  c++  java
  • 于ios7在遇到一些发展deprecated问题

    cell.textLabel.textAlignment = UITextAlignmentCenter;

    现在我想写cell.textLabel.textAlignment =NSTextAlignmentCenter;


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

    须要写成

    static NSString *TableSampleIdentifier =@"TableSampleIdentifier";

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


     [selfpresentModalViewController:calendarViewanimated:YES];

    改成  [selfpresentViewController:calendarViewanimated:YEScompletion:^{}];

    新接口的区别是提供了一个參数,同意你传入一个block。这个block的回调方法在VCviewWillDisappear方法后调用。也就是被隐藏的VC对象被释放后执行回调。

    这样做的优点:能够方便做多个UI效果之间的衔接和转换。


    在IOS7的PageControl控件

    调用[self.subviewsobjectAtIndex:i]

    取出的不是UIImageView而是UIView

    所以updateDots方法应该这样写:

    -(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]]

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




    版权声明:本文博主原创文章,博客,未经同意不得转载。

  • 相关阅读:
    不使用动态sql语句,正确书写case when中的null处理
    VC项目配置详解(转)
    JAXWS 访问SSL 的WebService 老是HTTP transport error: Connection refused错误的解决办法。
    [转]为什么开发人员工作10多年了还会迷茫?没有安全感?
    Tomcat 6.0.24 不兼容的APR版本问题
    WPF滚动条嵌套,响应鼠标滑轮事件的处理
    SqlServer无备份下误删数据恢复
    今天发现竟然有一个粉丝!!!
    好用的开源轻量级DHCP和DNS服务软件“Dual DHCP DNS Server”
    Windows下源码获取
  • 原文地址:https://www.cnblogs.com/bhlsheji/p/4829906.html
Copyright © 2011-2022 走看看