zhangchioulin
V2EX  ›  问与答

我想问一个 object-c 中的几个问题。请知道的朋友帮我看下,谢谢

  •  
  •   zhangchioulin · Apr 27, 2015 · 2757 views
    This topic created in 4230 days ago, the information mentioned may be changed or developed.
    1/我新建了一个Cocoa Touch Class 的类也写了代码,但是没有在ViewController中写关于那个类的代码,程序会不会自动帮我运行一遍那个类中的方法?

    2/感觉这门语言中的[]符号有点难懂,能说一下该在哪里用吗?
    8 replies  •  2015-04-29 19:52:03 +08:00
    yanchao7511461
    yanchao7511461
    Apr 27, 2015
    1
    刚看了一点语法。。。 []不是消息传递么? 可以理解成对象调用函数..... 刚开始看两天....
    zhangchioulin
    zhangchioulin
    OP
    Apr 27, 2015 via iPhone
    2
    @yanchao7511461 这个倒知道,就是有时候它调用的莫名其妙 比如说if
    zhangchioulin
    zhangchioulin
    OP
    Apr 27, 2015 via iPhone
    3
    我在class中设置了断点代码完全没有用到。该怎么用呢
    1q2w3e4r
    1q2w3e4r
    Apr 28, 2015
    4
    init你的类、并调用你设置断点的方法。所有的语言不都是这样吗
    zhangchioulin
    zhangchioulin
    OP
    Apr 28, 2015
    5
    @1q2w3e4r 是在哪里init呢?感觉好无力
    1q2w3e4r
    1q2w3e4r
    Apr 29, 2015
    6
    比如:你定义一个A,并些了test方法。断点这个方法
    @interface A : NSObject

    @end

    @implementation A

    - (void)test
    {

    }
    @end

    在ViewController里
    - (void)viewDidLoad
    {
    [super viewDidLoad];
    A *a= [[A alloc] init];
    [a test];
    }
    1q2w3e4r
    1q2w3e4r
    Apr 29, 2015❤️1
    7
    @zhangchioulin 你应该先了解下语言基础
    zhangchioulin
    zhangchioulin
    OP
    Apr 29, 2015
    8
    @1q2w3e4r 谢谢,我打算五一的时候把Objc基础看会
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   4339 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 07:04 · PVG 15:04 · LAX 23:04 · JFK 02:04
    ♥ Do have faith in what you're doing.