由于通常在要求采取行动的操作员时,他们通过向该方法发出呼吁的标语,如<条码>、IDButton或<条码>。 但是,如果你想从你的法典而不是由于一项行动而使用这种方法,你不能把人当作<条码>,<> > 条码>,这样你就通过<条码>。
另外,-(IBAction)
表示,这一方法可以通过<代码>与某项活动联系起来。 Interface Buildinger, 摘录Touch Upside
(或在外/上下)活动,从纽伦(或具有某种事件的任何其他控制)到File s Owner
, 并选定thumbTapped:
。
例如:
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
button.tag = 1001;
[button addTarget:self action:@selector(thumbTapped:) forControlEvents:UIControlEventTouchUpInside];
亮点放出后(电线仍在 but子内),将打电话<条码>。 标 标
- (IBAction)thumbTapped:(id)sender {
if ([sender isKindOfClass:[UIButton class]] && ((UIButton *)sender).tag == 1001) {
iPhoneImagePreviewViewController *previewVC = [[iPhoneImagePreviewViewController alloc] initWithNibName:@"iPhoneImagePreviewViewController" bundle:nil];
[self.navigationController pushViewController:previewVC animated:YES];
[previewVC release];
} else {
[[[[UIAlertView alloc] initWithTitle:[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleDisplayName"]
message:@"This method was called from somewhere in user code, not as the result of an action!"
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil] autorelease] show];
}
}