• IOS7 开发注意事项


    1,修改状态栏的样式和隐藏。

    首先,需要在Info.plist配置文件中,增加键:UIViewControllerBasedStatusBarAppearance,并设置为YES;

    然后,在UIViewController子类中实现以下两个方法:

    - (UIStatusBarStyle)preferredStatusBarStyle
    {
        return UIStatusBarStyleLightContent;
    }
    
    - (BOOL)prefersStatusBarHidden
    {
        return NO;
    }
    最后,在需要刷新状态栏样式的时候,调用[self setNeedsStatusBarAppearanceUpdate]方法即可刷新

    注意:
    [self setNeedsStatusBarAppearanceUpdate]在push  或者 present 的controller里面调用才起作用。

    2,UITableViewCell的定制。

    以前可以直接继承UITableViewCell然后drawRect;

    现在不行了,现在的UITableViewCell包含了一个scrollView,你重绘了UITableViewCell将会被这个scrollView遮住而完全没法显示.

    解决思路:

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

    {

    UITableViewCell * cell = [[[UITableViewCellallocinitWithStyle:UITableViewCellStyleDefaultreuseIdentifier:nilautorelease];

    UIView * subview = [[[XXView allocinitautorelease];

    subview.userInteractionEnabled = NO;// 不设为NO会屏蔽cell的点击事件

    subview.backgroundColor = [UIColorclearColor];// 设为透明从而使得cell.backgroundColor有效.

    subview.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

    [cell.contentView addSubview:subview];// cell.contentView是个readonly属性,所以别想着替换contentView了.

    return cell;

    }

    3,用户界面设计中,新增了一个重要的概念:UIKit动力

    默认支持如下5种动力行为:吸附行为(UIAttachmentBehavior),碰撞行为(UICollisionBehavior),重力行为(UIGravityBehavior),推动行为(UIPushBehavior),捕捉行为(UISnapBehavior;

    4,将TextKit整合到所有基于文本的控件中(Text Kit可以对程序中的文本内容进行精致的排版)。

    5,多任务

    iOS7中,应用程序的后台执行模型,新增了如下两种类型:

    1.fetch:

    应用程序可以从网络中有规律的下载新数据;

    注册方法为:在程序的Info.plist中,将UIBackgroundModes键值设置为fetch,然后在app delegate中,使用方法setMinimumBackgroundFetchInterval:来设置下载新数据操作之间的最小时间间隔。另外,必须在app delegate中实现application:performFetchWithCompletionHandler:方法以执行任意的下载。

    2.remote-notifaction:

    在iOS7中,通过推送通知,可以启动一个后台下载操作任务。

    要使用这种模型,只需要将程序Info.plist文件中的UIBackgroundModes键值设置为remote-notification,然后在app delegate中实现application:didReceiveRemoteNotification:fetchCompletionHandler: 方法。

    6,UIView类增加属性tintColor:可以使用一个tint color,并对view和它的subview有影响。

    7,UIViewController增加: View controller之间的切换(transition)可以自定义、驱动式交互(driven interactively),或者完全根据自己指定的切换方式来替换。

    8,UIView和UIScreen提供了一个新的方法:snapshot——返回一个view,可以用来显示程序的内容。 

    9,UIFontDescriptor对象使用一个属性字典来描述字体。通过font descriptor可以与其它平台相互交互。UIFont和UIFontDescriptor类支持动态调整字体大小。

    10,UIApplicationDelegate协议新增了处理后台获取数据的操作。

    - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler NS_AVAILABLE_IOS(7_0); 

    - (void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler NS_AVAILABLE_IOS(7_0); 

    - (void)application:(UIApplication *)application handleEventsForBackgroundURLSession:(NSString *)identifier completionHandler:(void (^)())completionHandler NS_AVAILABLE_IOS(7_0);

    11,Table view支持对row或其他元素高度的评估(estimating),这样可以提升Table view的滚动性能。

    12, Media Player Framework

          在Media Player framework中,MPVolumeView类可以判断用户选择的无线路由(wireless route,例如AirPlay和Bluetooth)是否可用。你也可以判断无线路由当前是否可用。关于新接口信息,请参看framework的头文件。关于Media Player framework涉及到的类,请参看Media Player Framework Reference。

    13, AV Foundation Framework

     AVAudioSession支持一些新的行为:可以选择音频输入的首选项,包括来自内置麦克风的音频;支持多通道的输入和输出

  • 相关阅读:
    node.js 安装后怎么打开 node.js 命令框
    thinkPHP5 where多条件查询
    网站title中的图标
    第一次写博客
    Solution to copy paste not working in Remote Desktop
    The operation could not be completed. (Microsoft.Dynamics.BusinessConnectorNet)
    The package failed to load due to error 0xC0011008
    VS2013常用快捷键
    微软Dynamics AX的三层架构
    怎样在TFS(Team Foundation Server)中链接团队项目
  • 原文地址:https://www.cnblogs.com/417460188dy/p/3315099.html
Copyright © 2020-2023  润新知