如何在继承与NSObject的类中触发UIAlertViewDelegate方法
1个回答
展开全部
#import "MySubView.h"
2
3 @implementation MySubView
4
5 - (id)initWithFrame:(CGRect)frame
6 {
7 self = [super initWithFrame:frame];
8 if (self) {
9 // Initialization code
10
11 self.backgroundColor = [UIColor darkGrayColor];
12
13 UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"testAlert" message:@"TEST" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
14 [alertView show];
15 }
16 return self;
17 }
18
19 - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
20 {
2
3 @implementation MySubView
4
5 - (id)initWithFrame:(CGRect)frame
6 {
7 self = [super initWithFrame:frame];
8 if (self) {
9 // Initialization code
10
11 self.backgroundColor = [UIColor darkGrayColor];
12
13 UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"testAlert" message:@"TEST" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
14 [alertView show];
15 }
16 return self;
17 }
18
19 - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
20 {
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询