我試圖在self.view.parentview
中顯示UIActionSheet。但我得到下面的警告,同時運行UIActionSheet showInView給出警告:無效的上下文0x0
<Error>: CGContextSetFillColorWithColor: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.
<Error>: CGContextSetStrokeColorWithColor: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.
<Error>: CGContextSaveGState: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.
代碼如下
self.dobActionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:nil cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil,nil];
[self.dobActionSheet addSubview:self.doneForActionSheet];
[self.dobActionSheet addSubview:self.cancelForActionSheet];
[self.dobActionSheet addSubview:self.dobDatepicker];
[self.dobActionSheet showInView:self.parentViewController.view];
我已經把斷點。但在此行中得到此警告[self.dobActionSheet showInView:self.parentViewController.view];
..
我已嘗試在Viewcontroller
中呈現這是embedded in tabbarController
的第一個索引。這就是爲什麼,努力表現與parentViewController.view
代替self.view
注:我看作是同樣的問題here。但無法找到答案。
嘗試使用[self.dobActionSheet showInView:self.view]; – iPatel
我無法做到這一點。因爲這個視圖控制器被嵌入在第一個索引處的tabbarcontroller中。這是正確的方法嗎?任何方式嘗試這一點,但得到相同的錯誤..! – Mani
可能的重複:http://stackoverflow.com/a/19111512/544265 – c0ming