1
是否有任何限制uitoolbar中的完成按鈕的框架。我希望它被定位到版權。我面臨的問題是,即使我在uitoolbar中點擊完成按鈕之外,完成按鈕的操作也會被調用。我只想在用戶點擊它時調用done操作。任何人都可以告訴我,我應該在下面的代碼中做什麼。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;
感謝您的答覆,並沒有任何方法可行添加完成按鈕我使用UIBarButtonSystemItemFlexibleSpace並與按鈕有它的框架設置正確的方式? – Sathish
我面對很多時間這個問題,這就是爲什麼我在UIBarButtonItem中使用UIbutton。 – yen