ios 怎么在uiviewcontroller上直接添加导航栏

 我来答
小炫马扎
高粉答主

2016-03-26 · 关注我不会让你失望
知道顶级答主
回答量:3.4万
采纳率:86%
帮助的人:4765万
展开全部
 1.设定imagePacker参数
  // Transform values for full screen support:
  #define CAMERA_TRANSFORM_X 1
  // this works for iOS 4.x
  #define CAMERA_TRANSFORM_Y 1.24299

  -(void)viewWillAppear:(BOOL)animated{
  
  UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
  imagePickerController.delegate = self;

  imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
  imagePickerController.showsCameraControls = NO;
  imagePickerController.navigationBarHidden = YES;
  imagePickerController.wantsFullScreenLayout = YES;
  imagePickerController.cameraViewTransform =CGAffineTransformScale(imagePickerController.cameraViewTransform, CAMERA_TRANSFORM_X,CAMERA_TRANSFORM_Y);
  cameraViewController = [[CameraOverlayViewControlleralloc]initWithNibName:@"CameraOverlayViewController" bundle:nil];
  imagePickerController.cameraOverlayView = cameraViewController.view;
  cameraViewController.pickerController = imagePickerController;
  [self presentModalViewController:imagePickerController animated:NO];
  [imagePickerController release];
  }

  2.代理方法

  -(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{
  [picker dismissModalViewControllerAnimated:NO];
  UIImage* image = [info valueForKey:UIImagePickerControllerOriginalImage];
  BeautifyPhotoViewController* beautifyPhotoViewController = [[BeautifyPhotoViewControlleralloc]initWithNibName:@"BeautifyPhotoViewController" bundle:nil];
  beautifyPhotoViewController.photoImage = image;
  [self.navigationController pushViewController:beautifyPhotoViewController animated:YES];
  [beautifyPhotoViewController release];
  }

  3.overlayView对应的controller

  #import "CameraOverlayViewController.h"

  @interface CameraOverlayViewController ()

  @end

  @implementation CameraOverlayViewController

  @synthesize pickerController;
  @synthesize cameraScaleBtn;
  @synthesize titleImageView;
  @synthesize flashModeBtn;
  @synthesize deviceMo
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式