2010-07-29 28 views
9

Tôi có đoạn code sau đây:vấn đề UIImagePickerController iPad

UIImagePickerController *imagePicker = [[UIImagePickerController alloc] initWithRootViewController:self]; 
imagePicker.delegate = self; 

popover = [[UIPopoverController alloc] initWithContentViewController:imagePicker]; 
[imagePicker release]; 
[popover presentPopoverFromRect:CGRectMake(100, 100.0, 0.0, 0.0) 
         inView:self.view 
     permittedArrowDirections:UIPopoverArrowDirectionAny 
         animated:YES]; 

Nhưng điều này chỉ phá hủy các self.view và không hiển thị gì cả. Khi tôi đặt inView: thành [self.view window] bộ chọn ít nhất sẽ hiển thị. Nhưng nó vẫn loại bỏ self.view. Tôi phải làm gì để chế độ xem không biến mất?

Trả lời

14

Bạn đang khởi tạo UIImagePickerController sai. Hãy thử thay đổi nó thành

[[UIImagePickerController alloc] init] 
+0

Thx, tôi phải bị mù! – V1ru8

2

Bạn đang cố gắng hiển thị cửa sổ bật lên bên trong chế độ xem với chính chế độ xem đó!

initWithRootViewController là chế độ xem (bộ điều khiển) hiển thị bên trong cửa sổ bật lên.

chế độ xem là chế độ xem cửa sổ bật lên sẽ bật lên

Các vấn đề liên quan