Implementing Delegate Pattern in Objective-C

前端 未结 6 453
谎友^
谎友^ 2020-12-18 09:48

I am building a class that handles NSURLConnection requests. To allow other classes to use this class, I would like to allow the main class to call a delegate when connecti

6条回答
  •  执念已碎
    2020-12-18 10:23

    For anyone interested in seeing an example of this the apple sample application NSURLCache implements a simple delegate around an NSURLConnection in NSURLCacheConnection.m

    The sample app is available through the apple developer connection here: http://developer.apple.com/iphone/library/samplecode/URLCache/index.html

    I found it pretty useful.

提交回复
热议问题