无论如何都要在uitoolbar中限制完成按钮的框架。我希望它位于右侧。我面临的问题是,即使我在uitoolbar中的完成按钮外部点击,也会调用完成按钮的操作。我希望仅在用户点击它时才调用完成操作。任何人都可以告诉我在下面的代码中应该做些什么。
UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(doneWriting:)];
UIBarButtonItem *flexible = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
//flexible.width=310;
[toolBar setItems:[NSArray arrayWithObjects:flexible,doneButton, nil]];
[doneButton release];
[flexible release];
labelItems = [[UITextView alloc] initWithFrame:(IS_IPAD ? CGRectMake(20, 5, 550, 70) : CGRectMake(10, 0, 223, 40))];
labelItems.delegate=self;
labelItems.font = [UIFont fontWithName:@"Arial" size:(IS_IPAD ? 33 : 15)];
labelItems.inputAccessoryView = toolBar;