swift1.2中没有oc中对应的方法:
+ (instancetype)appearanceWhenContainedIn:(Class <UIAppearanceContainer>)ContainerClass, ... NS_REQUIRES_NIL_TERMINATION;
解决方法:
在swift项目中新建oc类如下:
#import <UIKit/UIKit.h> @interface UIView (UIAppearance_Swift) + (instancetype)ls_appearanceWhenContainedWithin: (NSArray *)containers; @end
#import "UIView+UIAppearance_Swift.h" @implementation UIView (UIAppearance_Swift) + (instancetype)ls_appearanceWhenContainedWithin: (NSArray *)containers { NSUInteger count = containers.count; NSAssert(count <= 10, @"The count of containers greater than 10 is not supported."); return [self appearanceWhenContainedIn: count > 0 ? containers[0] : nil, count > 1 ? containers[1] : nil, count > 2 ? containers[2] : nil, count > 3 ? containers[3] : nil, count > 4 ? containers[4] : nil, count > 5 ? containers[5] : nil, count > 6 ? containers[6] : nil, count > 7 ? containers[7] : nil, count > 8 ? containers[8] : nil, count > 9 ? containers[9] : nil, nil]; } @end
swift调用即可。
BTW:
在xcode7beta,swift2中提供此方法:
@available(iOS 9.0, *) static func appearanceWhenContainedInInstancesOfClasses(containerTypes: [AnyObject.Type]) -> Self
相关推荐
通过阅读本书,你将学习 Swift 面向对象的概念、理解如何使用 Apple 的开发工具,以及探索 Cocoa 是如何提供 iOS 应用所需的底层功能的。
Xcode6.4 ios版 适合mac 10.10以下版本
Move into iOS development by getting a firm grasp of its fundamentals, including the Xcode IDE, the Cocoa Touch framework, and Swift 3 the latest version of Apple s acclaimed programming language....
iOS编程基础:Swift、Xcode和Cocoa入门指南.pdf
iOS编程基础:Swift、Xcode和Cocoa入门指南 (O’Reilly精品图书系列) iOS编程基础:Swift、Xcode和Cocoa入门指南 (O’Reilly精品图书系列) iOS编程基础:Swift、Xcode和Cocoa入门指南 (O’Reilly精品图书系列)
iOS 11 Programming Fundamentals with Swift Swift, Xcode, and Cocoa Basics 英文azw3 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传者或csdn删除
资源名称:iOS编程基础:Swift、Xcode和Cocoa入门指南资源太大,传百度网盘了,链接在附件中,有需要的同学自取。
Swift_2048 Swift 1.2 写的2048小游戏 用Xcode6.3 打开
The book starts with a gentle introduction to using Xcode and then guides you though the creation of your first simple application. You’ll start with designing basic user interfaces and then ...
这是我的原始react-native-macos驱动的的新SwiftUI版本 这个应用程式可协助您移除不需要的档案和不建议使用的档案,从而加快Xcode的速度。 您可以每周或每月清洁运行一次,以保持开发人员文件夹的运行状况并节省更...
Xcode的一些高效,好用的插件, 调色器, 图片加载,注释格式化,选中高亮显示,自动补全关键字等
2015.4.27日更新的最新版的Xcode 6.4来了,可以直接下载并安装到Mac里,上传到百度云盘
重要性等同于windows上的《Windows程序设计》的巨著!
Swimat:一个Xcode格式化程序插件,用于格式化您的swift代码
swiftmi-app 是 swiftmi.com 的移动端应用,采用 Swift 实现。系统环境:Xcode 6.4 编译通过Swift 标签:swiftmi
Swift Recipes provides a problem solution approach for dealing with key aspects of the Swift programming language (covering version 1.2), ensuring you have the indispensable reference you need to ...
DouBanFM_Demo 仿豆瓣音乐播放器 (Swift 1.2 Xcode6.3) 根据仅供学习 本程序代码较为简单具体功能实现可见如下视频(视频位于Resource目录下面)
英语原文pdf版本 RxSwift-Xcode8 & swift3.2,学习RxSwift必备