2013-03-16 44 views
1

我已經與部署目標IOS SDK爲6.0一個應用程序。後來我的客戶所要求的應用程序應該在iOS上運行5.0+ devices.So我已經改變了部署目標5.0和IB的禁用自動佈局財產提到堆棧here,但現在IAM越來越錯誤,如下圖所示:- [的UIBarButtonItem了setBackgroundImage:forState:風格:barMetrics:]:無法識別的選擇發送到實例

> - [的UIBarButtonItem了setBackgroundImage:forState:風格:barMetrics:]:無法識別的選擇發送到實例0x2971f0

,我沒有發現什麼毛病我的UIBarButtonItem,

addButton = [[UIBarButtonItem alloc] 
     initWithBarButtonSystemItem:UIBarButtonSystemItemAdd 
     target:self 
     action:@selector(addProject)]; 

現在iam奮力尋找解決方案,等待您的寶貴幫助.. 在此先感謝。

+1

可用 – 2013-03-16 09:29:09

+1

我沒有使用過類似的任何方法這個方法只適用於iOS 6.0以上版本可用.. 這就是我在我的代碼中: - addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(addProject)]; – 2013-03-16 09:31:05

+0

它在iOS 5.0及更高版本中可用。 – 2013-03-16 09:32:14

回答

2

setBackgroundImage:forState:barMetrics:是可用的iOS 5.0+但setBackgroundImage:forState:style:barMetrics:僅在iOS 6.0以上版本

+2

'setBackgroundImage:forState:barMetrics:'在iOS ** 5.0 + **中可用,但'setBackgroundImage:forState:style:barMetrics:'僅在iOS ** 6.0 + **中可用。 – 2013-03-16 09:51:31

+0

ohh ..我看到了..yup ..我已經編輯了答案... – 2013-03-16 10:03:07

+0

做一個如果響應選擇器來選擇哪一個,而不是基於操作系統版本。這是知道使用哪一個的正確方法。 – badweasel 2013-03-16 10:07:11

相關問題