草庐IT

tst_Class

全部标签

objective-c - swift 错误 : class method "someMethod() is unavailable, use object construction Class()"

Objective-CAPI使用类方法进行大量对象构建:+(NSDate*)date;+(NSURL*)urlWithString:(NSString*)string;+(instancetype)layerWithSession:(AVCaptureSession*)session有时我什至看到这些作为类方法出现在旧的Swift教程中,但是当我尝试调用它们时,我会遇到如下编译器错误:date()isunavailable,useobjectconstructionNSDate()urlWithString()isunavailable,useobjectconstructionNSU

ios - 从父类(super class)覆盖 IBOutlet 属性?

我想在修改IBOutlet属性的框架中创建一个父类(superclass)。但是,我希望将子类连接到Storyboard,因为我不想将控件连接到框架中的类。例如,我的框架中的父类(superclass)如下所示:publicclassMySuperDetailViewController:UIViewController{@IBOutletpublicweakvartitleLabel:UILabel?@IBOutletpublicweakvardateLabel:UILabel?@IBOutletpublicweakvarcontentWebView:UIWebView?...}然后

ios - 从父类(super class)覆盖 IBOutlet 属性?

我想在修改IBOutlet属性的框架中创建一个父类(superclass)。但是,我希望将子类连接到Storyboard,因为我不想将控件连接到框架中的类。例如,我的框架中的父类(superclass)如下所示:publicclassMySuperDetailViewController:UIViewController{@IBOutletpublicweakvartitleLabel:UILabel?@IBOutletpublicweakvardateLabel:UILabel?@IBOutletpublicweakvarcontentWebView:UIWebView?...}然后

ios - "Launch screens may not set custom class names"

我正在尝试将初始ViewController设置为自定义类。在以前的版本中这是可行的,但出于某种原因我现在不能这样做。我有一个UIViewController类(IntroVC)。在Storyboard中,我创建了一个新的ViewController对象并设置它的类(IdentityInspector->CustomClass->Class)到IntroVC。IntroVC是一个.swift文件,包含IntroVC类的viewDidLoad()和didReceiveMemoryWarning()函数:UIViewController.XCode截图如下错误介绍VCStoryboard有

ios - "Launch screens may not set custom class names"

我正在尝试将初始ViewController设置为自定义类。在以前的版本中这是可行的,但出于某种原因我现在不能这样做。我有一个UIViewController类(IntroVC)。在Storyboard中,我创建了一个新的ViewController对象并设置它的类(IdentityInspector->CustomClass->Class)到IntroVC。IntroVC是一个.swift文件,包含IntroVC类的viewDidLoad()和didReceiveMemoryWarning()函数:UIViewController.XCode截图如下错误介绍VCStoryboard有

class - 如何编写枚举类型的 Swift 泛型函数?

我想使用Swift编写一个协议(protocol),该协议(protocol)指定实现类必须具有一个采用枚举(遵守给定协议(protocol))的函数,其中该枚举类型是通用指定的。我试过这个:protocolMessage{}protocolSubscriber{funcreceive(message:T)}enumGreeting:Message{caseHello,Goodbye}classSomeObject:Subscriber{funcreceive(message:Greeting){switchmessage{case.Hello:println("Hello")case

class - 如何编写枚举类型的 Swift 泛型函数?

我想使用Swift编写一个协议(protocol),该协议(protocol)指定实现类必须具有一个采用枚举(遵守给定协议(protocol))的函数,其中该枚举类型是通用指定的。我试过这个:protocolMessage{}protocolSubscriber{funcreceive(message:T)}enumGreeting:Message{caseHello,Goodbye}classSomeObject:Subscriber{funcreceive(message:Greeting){switchmessage{case.Hello:println("Hello")case

Could not initialize class org.codehaus.groovy.vmplugin.v7.Java7

AndroidStudio2022.2.1同步时出现的报错,原因是使用了AS自带的jdk17,我们换成自己电脑上安装的jdk1.8即可,没有安装的同学看JDK安装教程。1、首先File——>Setting——>BuildTools——>Gradle,看到我们的GradleJDK路径。2、更换为我们安装好的jdk1.8,然后点击Apply,再点击OK。3、重新同步项目,发现问题解决,BUILDSUCCESSFUL。

class - Swift 和使用类扩展

我不明白为什么程序员在他们的类实现中使用extension关键字。您可以在其他主题中读到代码在语义上更加分离等。但是当我使用自己的代码时,使用//MARK-Something对我来说感觉更清楚。然后当你在Xcode中使用methodslist(ctrl+6)时,一切都一目了然。在Apple文档中,您可以阅读:“Extensionsaddnewfunctionalitytoanexistingclass,structure,orenumerationtype.”那么为什么不直接在我自己的类中编写我自己的代码呢?不像我想扩展一些外部类的功能,比如NSURLSession或Dictionar

class - Swift 和使用类扩展

我不明白为什么程序员在他们的类实现中使用extension关键字。您可以在其他主题中读到代码在语义上更加分离等。但是当我使用自己的代码时,使用//MARK-Something对我来说感觉更清楚。然后当你在Xcode中使用methodslist(ctrl+6)时,一切都一目了然。在Apple文档中,您可以阅读:“Extensionsaddnewfunctionalitytoanexistingclass,structure,orenumerationtype.”那么为什么不直接在我自己的类中编写我自己的代码呢?不像我想扩展一些外部类的功能,比如NSURLSession或Dictionar