actionButton无法在XCODE中工作

时间:2014-12-11 01:01:39

标签: ios objective-c uibarbuttonitem

我的xcode项目中有这段代码。我无法点击按钮并使其工作。该按钮显示在我的模拟器中,但单击它时不起作用。有没有人对这里发生的事情有任何想法?它在某一点上工作但现在似乎失败了。也许我不小心改变了构建设置?还是模拟器设置?任何想法将不胜感激!!

按钮代码

-(void)viewDidLoad{
[super viewDidLoad];

UIBarButtonItem *actionButton = [[UIBarButtonItem alloc]
                                  initWithBarButtonSystemItem:UIBarButtonSystemItemAction
                                  target:self action:@selector(openWebLink)];
NSArray *items = [NSArray arrayWithObjects: actionButton,  nil];
[self.toolbar setItems:items animated:NO];

[actionButton release]; }

以下是操作的代码:

-(void)openWebLink{
// open a dialog with an OK and cancel button
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Do you want to apply for this job?"
                                                         delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"OK" otherButtonTitles:nil];
actionSheet.actionSheetStyle = UIActionSheetStyleDefault;
    [actionSheet showFromToolbar:_toolbar];
[actionSheet release];  }

0 个答案:

没有答案