我在我的視圖中以編程方式創建2個按鈕。兩個選擇器方法都存在,但仍然拋出'無法識別的選擇器'錯誤。我讀了一些關於檢查殭屍的內容。但我激活它(xcode 4.2),並沒有看到任何有關任何殭屍。這裏是代碼..儘管選擇器存在,但UIButton選擇器正在拋出'無法識別的選擇器'
- (void)viewDidLoad
{
for(int i = 0; i < [list count]; i++){
... if statement checks to add text fields
}
UIButton *submit = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[submit addTarget:self action:@selector(submission:)
forControlEvents:UIControlEventTouchUpInside];
[submit setTitle:@"Submit" forState:UIControlStateNormal];
submit.frame = CGRectMake(x+ 170.0, y, 72, 37);
UIButton *addition = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[addition addTarget:self action:@selector(addition:)
forControlEvents:UIControlEventTouchUpInside];
[addition setTitle:@"Additional Mission" forState:UIControlStateNormal];
addition.frame = CGRectMake(x, y, 140, 37);
y = y+90;
[inputsView addSubview:submit];
[inputsView addSubview:addition];
[inputsView setScrollEnabled:YES];
[inputsView setContentSize:CGSizeMake(320, y)];
}
- (void)submission{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Submission Complete" message:@"Submission"
delegate:self cancelButtonTitle:@"No" otherButtonTitles:@"Yes", nil];
[alert show];
}
-(void)addition{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Creating Additional Mission" message:@"Additional Mission"
delegate:self cancelButtonTitle:@"No" otherButtonTitles:@"Yes", nil];
[alert show];
}
需要注意的一點.. inputsView是一個UIScrollView這是我的視圖控制器內。
在此先感謝。
Ooooh ..哇。這是令人尷尬的。謝謝! – 2012-02-07 15:38:25