Heim  >  Fragen und Antworten  >  Hauptteil

ios - swift纯新手,请教各位.swift中使用self=super.init遇到错误

在声明的方法中想调用self=super.init,遇到错误. cannot assign to value:'self' is immutable

public class initWithData:NSObject{

func initWithDataModel(superID:Int,myID:Int,grade:Int,isOpen:Bool,showName:NSString,rightShowName:NSString){

    
    
    if(self = super.init){
        
    }
    
    
}
黄舟黄舟2711 Tage vor722

Antworte allen(1)Ich werde antworten

  • ringa_lee

    ringa_lee2017-04-18 09:48:33

    不用判断,直接super.init()即可

    Antwort
    0
  • StornierenAntwort