利用协议实现回调函数 第2页


01.#import <UIKit/UIKit.h>  
02.#import "myViewDelegate.h"  
03. 
04.@interface ViewController : UIViewController<myViewDelegate> 
05. 
06.@end 
07.//  
08.//  ViewController.m  
09.//  CallBackDemo  
10.//  
11.//  Created by apple on 13-3-31.  
12.//  Copyright (c) 2013年 apple. All rights reserved.  
13.//  
14. 
15.#import "ViewController.h"  
16.#import "Test.h"  
17. 
18.@interface ViewController () 
19. 
20.@end 
21. 
22.@implementation ViewController 
23. 
24.- (void)viewDidLoad 
25.{ 
26.    [super viewDidLoad]; 
27.    // Do any additional setup after loading the view, typically from a nib.  
28.         
29.    Test *test =  [[Test alloc]init]; 
30.    test.delegate=self; 
31.    [test callback]; 
32.} 
33. 
34.- (void)didReceiveMemoryWarning 
35.{ 
36.    [super didReceiveMemoryWarning]; 
37.    // Dispose of any resources that can be recreated.  
38.} 
39. 
40.-(void) CallBackFun 
41.{ 
42.    NSLog(@"CallBack!"); 
43.} 
44. 
45.@end 论文网 

上一页  [1] [2] 

Copyright © 2007-2012 www.chuibin.com 六维论文网 版权所有