我有UIViewController
與UIToolBar
。
而UIToolBar
有三個按鈕[options,pickphotofromlibrary,camera].
解除UIImagePickerController後推UIView控制器
當用戶按下它們被帶到定製照相機接口[疊加]相機按鈕。
代碼:
- (void)showImagePickerForSourceType:(UIImagePickerControllerSourceType)sourceType
{
if (self.imageView.isAnimating)
{
[self.imageView stopAnimating];
}
UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.modalPresentationStyle = UIModalPresentationCurrentContext;
imagePickerController.sourceType = sourceType;
imagePickerController.delegate = self;
if (sourceType == UIImagePickerControllerSourceTypeCamera)
{
/*
The user wants to use the camera interface. Set up our custom overlay view for the camera.
*/
imagePickerController.showsCameraControls = NO;
/*
Load the overlay view from the OverlayView nib file. Self is the File's Owner for the nib file, so the overlayView outlet is set to the main view in the nib. Pass that view to the image picker controller to use as its overlay view, and set self's reference to the view to nil.
*/
[[NSBundle mainBundle] loadNibNamed:@"overlayView" owner:self options:nil];
self.overlayView.frame = imagePickerController.cameraOverlayView.frame;
imagePickerController.cameraOverlayView = self.overlayView;
self.overlayView = nil;
}
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent animated:YES];
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationSlide];
self.imagePickerController = imagePickerController;
[self.navigationController presentViewController:self.imagePickerController animated:YES completion:nil];
}
因此,當用戶需要我需要推動其他視圖,顯示它們的表view.I已經創建了一個筆尖文件,但不知道如何圖片進一步進行。
任何幫助,將不勝感激..
噢委託你打敗了我):不公平 –
但它是一個nib文件,如何加載?我試過這個Viewcontroller * controller = [viewcontroller alloc] initwithnib ..... self.navigation pushviewcontroller:controller animation:yes。但我的程序事件導致異常 – TryingToLearn
@rak - 什麼是錯誤,檢查這個問題的加載nib文件..http://stackoverflow.com/questions/863321/iphone-how-to-load-a-view-using -a-筆尖文件創建-與接口建設者 – iPatel