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是一个对象指针,可以转换为任何数据类型.不常用

  • 相关阅读:
    数据结构中的知识
    Java中的小知识
    安装Linux虚拟机
    2.Two Sum
    1005. Maximize Sum Of Array After K Negations
    Leetcode刷题记录
    Markdown的使用笔记
    CCF历年试题总结
    在Linux上搭建Hadoop
    配置和使用连接池
  • 原文地址:https://www.cnblogs.com/mcy0808/p/8986797.html
Copyright © 2011-2022 走看看