background image

35         [m_button setTitle:@"tap me!" forState:UIControlStateNormal];
36         [self addSubview:m_button];
37     }
38     return self;
39 }
40
41 -(void)connection:(UIController*)target{
42  

 

 

 [m_button 

addTarget:target 

action:@selector(buttonClick:) 

forControlEvents:UIControlEventTouchUpInside];
43 }
44
45 -(void)setButtonText:(NSString*)text{
46     [m_button setTitle:text forState:UIControlStateNormal];
47 }
48
49 /**
50 * 调整布局
51 */
52 -(void)layoutSubviews{
53      m_button.frame = CGRectMake(100, 100, 64, 24);
54 }
55
56 - (void)dealloc
57 {
58     [m_button release];
59     [super dealloc];
60 }
61
62 @end
63
64 //
65 //  MyController.h
66 //
67
68 #import <UIKit/UIKit.h>
69
70 @class MyView;
71 @interface MyController : UIViewController {
72     /**
73      * 关联 view
74      */
75     MyView* m_myView;
76     
77     /**