xcode7.1新建项目等问题

一、LaunchImage不显示

  解决办法:

  1.在Assets.xcassets新建LaunchImage并加入不同屏幕的launchImage

  2.点击项目名,点击TARGETS,选择General,找到App Icons and Launch Images,1)在Launch Images Source 中选中LaunchImage;2)在Launch Screen File 中清除内容,使其为空

 

二、tabBarItem设置选中的图片,全让颜色填充了

  解决办法:

1.调用:

  @available(iOS 7.0, *)

  public func imageWithRenderingMode(renderingMode: UIImageRenderingMode) -> UIImage

如:

  tabBarItem.image = UIImage(named: "tab_nor")?.imageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal)

  tabBarItem.selectedImage = UIImage(named: "tab_sel")?.imageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal)

 

三、statusBar的颜色,启动时隐藏statusBar,启动后显示

  1.在info.plist中添加 Status bar is initially hidden 设为YES(启动时不显示statusBar)

  2.在AppDelegate中调用application.statusBarHidden = false

  3.在info.plist中添加 View controller-based status bar appearance 设为NO(不显示基本的状态栏)

  4.application.statusBarStyle = UIStatusBarStyle.LightContent(将状态栏风格设为亮色,即白色)

 

四、Xcode7 beta 网络请求报错:The resource could not be loaded because the App Transport Security policy requir

  iOS9引入了新特性App Transport Security (ATS)。详情:App Transport Security (ATS)新特性要求App内访问的网络必须使用HTTPS协议。

  若要使用HTTP协议,解决办法:

  1.在Info.plist中添加NSAppTransportSecurity类型Dictionary。
  2.在NSAppTransportSecurity下添加NSAllowsArbitraryLoads类型Boolean,值设为YES

 

五、Swift和OC混编

  1.Swift项目中,如果加入OC文件,系统会弹出Would you like to configure an Objective-C bridging header?的选项,选择yes,Xocde就会在新建OC文件的同时帮我们新建一个 xxx-Bridging-Header.h 文件,xxx是你的项目名称(Product Module),在这个文件里加入OC的头文件,即可在swift中使用OC

  2.如果想自己新建 xxx-Bridging-Header.h 文件,步骤是:File > New > File > (iOS or OS X) > Source > Header File,切记,名字 一定要 是 项目工程名-Bridging-Header,然后在项目的 Build Settings > Swift Compiler选项里有这个Bridging Header,设置路径为 项目名/项目名-Bridging-Header.h

  3.而要在OC中调用swift代码,只需引用头文件  #import "项目名-Swift.h" (这个是系统自动生成的头文件定义了项目中所有的Swift文件)

转载于:https://www.cnblogs.com/hcsaaron/p/4936554.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值