【发布时间】:2010-06-02 18:37:22
【问题描述】:
我有一个滚动视图;在里面我添加了一个或多个文本视图;我在每个文本视图中添加一个按钮:
UIScrollView UITextView 用户界面按钮 UITextView 用户界面按钮 ...这是代码的一部分:
- (void)viewDidLoad {
...
[self loadUI];
...
}
-(void) loadUI {
UITextView *textView;
...
for (...) {
UIButton *editButton = [[UIButton alloc] initWithFrame:
CGRectMake(self.scrollView.frame.size.width - 230, 0, 50, 20)];
...
[editButton addTarget:self action:@selector(editPressed:)
forControlEvents:UIControlEventTouchUpInside];
...
textView = [[CustomTextView alloc] initWithFrame:
CGRectMake(10, dynamicHeight, self.queuedView.frame.size.width - 100, 500)];
textView.userInteractionEnabled = NO;
...
[textView addSubview:editButton];
[editButton release];
...
[self.scrollView addSubview:textView];
[textView release];
}
}
- (IBAction) editPressed:(id)sender {
...
}
由于某种原因,当我按下按钮时不会调用 editPressed 方法。任何想法为什么?我尝试将为文本视图启用的交互设置为“是”,但仍然没有。我将形式 (IBAction) 更改为 (void),仍然没有。
谢谢你, 米海
【问题讨论】:
标签: iphone uiscrollview uibutton uitextview