ios 怎么在uiviewcontroller上直接添加导航栏
1个回答
展开全部
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
// 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
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询