1、LaunchImage不显示swift
解决办法:网络
1.在Assets.xcassets新建LaunchImage并加入不一样屏幕的launchImageapp
2.点击项目名,点击TARGETS,选择General,找到App Icons and Launch Images,1)在Launch Images Source 中选中LaunchImage;2)在Launch Screen File 中清除内容,使其为空ui
2、tabBarItem设置选中的图片,全让颜色填充了spa
解决办法:code
1.调用:图片
@available(iOS 7.0, *)it
public func imageWithRenderingMode(renderingMode: UIImageRenderingMode) -> UIImageio
如:class
tabBarItem.image = UIImage(named: "tab_nor")?.imageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal)
tabBarItem.selectedImage = UIImage(named: "tab_sel")?.imageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal)
3、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(将状态栏风格设为亮色,即白色)
4、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
5、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文件)