2013-04-15 15 views
1

我有這些代碼行將我的完成按鈕放在工具欄中。 我不知道如何居中。我在網上嘗試了很多東西,但我無法找到一個工作。如何在此場景中居中按鈕

self.closeButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(close)]; 
    self.closeButton.enabled = YES; 
    self.closeButton.imageInsets = UIEdgeInsetsZero; 
    self.closeButton.style = UIBarButtonItemStylePlain; 
    self.closeButton.width = 32.000; 

感謝

回答

1

你之前和你closeButton後加用UIBarButtonSystemItemFlexibleSpace一個UIBarButtonSystemItem

UIBarButtonItem* flexibleSpace = 
    [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil]; 
+0

你能告訴我它應該看看我的代碼嗎?我得到一個未使用的變量flexiblespace – Jayrok94

+0

現在它的工作謝謝 – Jayrok94