background image

Ios 开 发 基 础 :

View

 

     

   

    Controller

 

     

代码组

 

 

 

1

//

2

//  MyView.h

3

//

4
5

#import <UIKit/UIKit.h>

6
7

@interface MyView : UIView {

8

    UIButton* m_button;

9

}

10
11 /**
12 * 关联 event,delegate
13 */
14 -(void)connection:(id)target;
15 -(void)setButtonText:(NSString*)text;
16
17 @end
18
19 //
20 //  MyView.m
21 //
22
23 #import "MyView.h"
24 @implementation MyView
25
26
27 - (id)initWithFrame:(CGRect)frame
28 {
29     self = [super initWithFrame:frame];
30     if (self) {
31         /**
32          * 组装 view
33          */
34         m_button = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain];