zoukankan      html  css  js  c++  java
  • IOS菜鸟学习

    1.NS是系统库.
    2.IOS类的声明:
    @interface MyObject : NSObject {
        int memberVar1; // 实体变量
        id  memberVar2;
    }

    +(return_type) class_method; // 类方法

    -(return_type) instance_method1; // 实例方法
    -(return_type) instance_method2: (int) p1;
    -(return_type) instance_method3: (int) p1 andPar: (int) p2;
    @end

    //+:代表类函数,不需要实例即可使用.同c++
        声明interface开始,end结束.
    3.IOS字符串:
    NSString* myString = @"My String ";
    NSString* anotherString = [NSString stringWithFormat:@"%d %s", 1, @"String"];

    // 从一个C语言字符串创建Objective-C字符串
    NSString*  fromCString = [NSString stringWithCString:"A C string"
    encoding:NSASCIIStringEncoding];

    @是一个助记符,通过助记符可以用常量字符串创建对象.

    4.IOS类的实现
    @implementation MyObject {
      int memberVar3; //私有實體變數
    }

    +(return_type) class_method {
        .... //method implementation
    }
    -(return_type) instance_method1 {
         ....
    }
    -(return_type) instance_method2: (int) p1 {
        ....
    }
    -(return_type) instance_method3: (int) p1 andPar: (int) p2 {
        ....
    }
    @end

    implementation开始,end结束.

    5.中括号的用法[类名 类方法]或[对象 实例方法]

    [VLPAProxyhelper morePlayList:listDic]VLPAProxyhelper类名 morePlayList类方法 listDic参数

    6.id是一个对象指针,可以转换为任何数据类型.不常用

  • 相关阅读:
    经典SQL语句集锦(收藏版)
    硬件访问服务学习笔记_WDS
    Android 工具视频学习笔记_WDS
    Android资源收集
    Android USB gadget configfs学习笔记总结
    IP、端口号、MAC
    Java中的泛型
    git配置config文件
    Java基础知识总结
    Java中的继承抽象类和接口
  • 原文地址:https://www.cnblogs.com/mcy0808/p/8986797.html
Copyright © 2011-2022 走看看