解决 黑色背景问题
2012-05-09 15:00
405 查看
#import <Foundation/Foundation.h>
@interface CustomerViewController : UIImagePickerController<UIImagePickerControllerDelegate,UINavigationControllerDelegate> {
UIToolbar *hortoolBar;
UIToolbar *vertoolBar;
UIImageView *vBackView; //垂直方向银色背景
UIImageView *hBackView; //水平方向银色背景
}
@property (nonatomic,retain) UIToolbar *hortoolBar;
@property (nonatomic,retain) UIToolbar *vertoolBar;
@property (nonatomic,retain) UIImageView *vBackView;
@property (nonatomic,retain) UIImageView *hBackView;
-(void)setNewController;
@end
//
// CustomerViewController.m
// MyUimageView
//
// Created by wgd on 12-5-3.
// Copyright 2012 __MyCompanyName__. All rights reserved.
//
#import "CustomerViewController.h"
@implementation CustomerViewController
@synthesize hortoolBar,vertoolBar,vBackView,hBackView;
-(CustomerViewController *)init
{
[super init];
[self setNewController];
return self;
}
-(void)check:(id)sender
{
self.showsCameraControls = NO;
[self takePicture];
}
-(void)cancelTakePhoto:(id)sender
{
[self.delegate imagePickerControllerDidCancel:self];
}
-(void)setNewController
{
self.vertoolBar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 970, 768, 54)];
[self.view addSubview:vertoolBar];
self.vBackView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 768, 54)];
vBackView.image = [UIImage imageNamed:@"verBackView.png"];
[self.vertoolBar addSubview:vBackView];
[vBackView release];
UIBarButtonItem *btn1 = [[UIBarButtonItem alloc] initWithTitle:@"取消" style:UIBarButtonSystemItemCancel target:self action:@selector(cancelTakePhoto:)];
btn1.width = 100;
UIBarButtonItem *btn11 = [[UIBarButtonItem alloc] initWithTitle:@"" style:
UIBarButtonItemStylePlain target:self action:nil];
btn11.width = 530;
btn11.enabled = NO;
UIBarButtonItem *btn2= [[UIBarButtonItem alloc] initWithTitle:@"拍照" style: UIBarButtonSystemItemCancel target:self action:@selector(check:)];
// UIBarButtonItem *btn2= [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"test.png"] style:UIBarButtonSystemItemCancel target:self action:@selector(check:)];
btn2.width = 100;
NSMutableArray *btnArray = [[NSMutableArray alloc] initWithObjects:btn1,btn11,btn2,nil];
vertoolBar.items = btnArray;
[btn1 release];
[btn11 release];
[btn2 release];
UIBarButtonItem *btn3 = [[UIBarButtonItem alloc] initWithTitle:@"取消" style:UIBarButtonSystemItemCancel target:self action:@selector(cancelTakePhoto:)];
btn3.width = 100;
UIBarButtonItem *btn31 = [[UIBarButtonItem alloc] initWithTitle:@"" style:
UIBarButtonItemStylePlain target:self action:nil];
btn31.width = 790;
btn31.enabled = NO;
UIBarButtonItem *btn4= [[UIBarButtonItem alloc] initWithTitle:@"拍照" style:UIBarButtonSystemItemCancel target:self action:@selector(check:)];
btn4.width = 100;
NSMutableArray *btnArray2 = [[NSMutableArray alloc] initWithObjects:btn3,btn31,btn4,nil];
[btn3 release];
[btn31 release];
[btn4 release];
self.hortoolBar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 714, 1024, 54)];
self.hBackView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0 , 1024, 54)];
hBackView.image = [UIImage imageNamed:@"horBackView.png"];
[hortoolBar addSubview:hBackView];
[hBackView release];
hortoolBar.items = btnArray2;
[self.view addSubview:hortoolBar];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
return YES;
}
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
self.showsCameraControls = NO;
if(UIDeviceOrientationLandscapeRight ==toInterfaceOrientation||
UIDeviceOrientationLandscapeLeft == toInterfaceOrientation)
{
vertoolBar.hidden = YES;
hortoolBar.hidden = NO;
}
else
{
hortoolBar.hidden = YES;
vertoolBar.hidden = NO;
}
}
-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{
self.showsCameraControls = YES;
}
-(void)dealloc
{
[vertoolBar release];
[vertoolBar release];
[vBackView release];
[hBackView release];
[super dealloc];
}
@end
@interface CustomerViewController : UIImagePickerController<UIImagePickerControllerDelegate,UINavigationControllerDelegate> {
UIToolbar *hortoolBar;
UIToolbar *vertoolBar;
UIImageView *vBackView; //垂直方向银色背景
UIImageView *hBackView; //水平方向银色背景
}
@property (nonatomic,retain) UIToolbar *hortoolBar;
@property (nonatomic,retain) UIToolbar *vertoolBar;
@property (nonatomic,retain) UIImageView *vBackView;
@property (nonatomic,retain) UIImageView *hBackView;
-(void)setNewController;
@end
//
// CustomerViewController.m
// MyUimageView
//
// Created by wgd on 12-5-3.
// Copyright 2012 __MyCompanyName__. All rights reserved.
//
#import "CustomerViewController.h"
@implementation CustomerViewController
@synthesize hortoolBar,vertoolBar,vBackView,hBackView;
-(CustomerViewController *)init
{
[super init];
[self setNewController];
return self;
}
-(void)check:(id)sender
{
self.showsCameraControls = NO;
[self takePicture];
}
-(void)cancelTakePhoto:(id)sender
{
[self.delegate imagePickerControllerDidCancel:self];
}
-(void)setNewController
{
self.vertoolBar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 970, 768, 54)];
[self.view addSubview:vertoolBar];
self.vBackView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 768, 54)];
vBackView.image = [UIImage imageNamed:@"verBackView.png"];
[self.vertoolBar addSubview:vBackView];
[vBackView release];
UIBarButtonItem *btn1 = [[UIBarButtonItem alloc] initWithTitle:@"取消" style:UIBarButtonSystemItemCancel target:self action:@selector(cancelTakePhoto:)];
btn1.width = 100;
UIBarButtonItem *btn11 = [[UIBarButtonItem alloc] initWithTitle:@"" style:
UIBarButtonItemStylePlain target:self action:nil];
btn11.width = 530;
btn11.enabled = NO;
UIBarButtonItem *btn2= [[UIBarButtonItem alloc] initWithTitle:@"拍照" style: UIBarButtonSystemItemCancel target:self action:@selector(check:)];
// UIBarButtonItem *btn2= [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"test.png"] style:UIBarButtonSystemItemCancel target:self action:@selector(check:)];
btn2.width = 100;
NSMutableArray *btnArray = [[NSMutableArray alloc] initWithObjects:btn1,btn11,btn2,nil];
vertoolBar.items = btnArray;
[btn1 release];
[btn11 release];
[btn2 release];
UIBarButtonItem *btn3 = [[UIBarButtonItem alloc] initWithTitle:@"取消" style:UIBarButtonSystemItemCancel target:self action:@selector(cancelTakePhoto:)];
btn3.width = 100;
UIBarButtonItem *btn31 = [[UIBarButtonItem alloc] initWithTitle:@"" style:
UIBarButtonItemStylePlain target:self action:nil];
btn31.width = 790;
btn31.enabled = NO;
UIBarButtonItem *btn4= [[UIBarButtonItem alloc] initWithTitle:@"拍照" style:UIBarButtonSystemItemCancel target:self action:@selector(check:)];
btn4.width = 100;
NSMutableArray *btnArray2 = [[NSMutableArray alloc] initWithObjects:btn3,btn31,btn4,nil];
[btn3 release];
[btn31 release];
[btn4 release];
self.hortoolBar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 714, 1024, 54)];
self.hBackView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0 , 1024, 54)];
hBackView.image = [UIImage imageNamed:@"horBackView.png"];
[hortoolBar addSubview:hBackView];
[hBackView release];
hortoolBar.items = btnArray2;
[self.view addSubview:hortoolBar];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
return YES;
}
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
self.showsCameraControls = NO;
if(UIDeviceOrientationLandscapeRight ==toInterfaceOrientation||
UIDeviceOrientationLandscapeLeft == toInterfaceOrientation)
{
vertoolBar.hidden = YES;
hortoolBar.hidden = NO;
}
else
{
hortoolBar.hidden = YES;
vertoolBar.hidden = NO;
}
}
-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{
self.showsCameraControls = YES;
}
-(void)dealloc
{
[vertoolBar release];
[vertoolBar release];
[vBackView release];
[hBackView release];
[super dealloc];
}
@end
相关文章推荐
- 解决Ubuntu Eclipse 代码浮层黑色背景问题
- 解决thinkphp图片上传生成缩略图背景为黑色的问题
- JAVA 绘制验证码图像及解决黑色背景问题
- listView解决滑动时黑色背景问题
- 下载保存的图片背景由透明变为黑色问题解决
- IE8滤镜效果不支持,背景显示为黑色问题解决办法
- 把view保存为图片的方法以及解决保存后图片背景变黑色的问题
- 解决listview设置背景图片以后,拖动出现黑色的问题。
- 解决java压缩图片透明背景变黑色的问题
- 解决Ubuntu Eclipse 代码浮层黑色背景问题
- 将Bitmap用Base64转码成字符串,再解码回来出现黑色背景的问题原因及解决办法。
- android开发之解决ListView滑动时背景是黑色的问题
- ListView滑动时 item出现黑色背景的问题的解决方法
- Android学习:ListView拖动时背景变黑色问题解决方法
- ListView滑动时 item出现黑色背景的问题的解决方法
- 解决圆角dialog黑色(白色)背景问题
- 如何解决iphone手机微信浏览器中滑动到页面底部出现黑色背景盖住position:fixed的页面元素的问题?
- 解决 Gnome3 窗口背景是黑色的问题
- 解决Ubuntu Eclipse 代码浮层黑色背景问题
- 解决Qt中QLabel控件加载动态图出现黑色背景的问题