解决当把系统自带的UIImagePickerController 作为一个uiviewcontroller时有20像素间隙的问题
2013-12-15 12:11
986 查看
#pragma mark --
#pragma mark Methods
- (void)initImagePickerControllerInterface
{
if (!_imagePickerController) {
_imagePickerController = [[UIImagePickerController
alloc] init];
}
[_imagePickerController
setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
[_imagePickerController
setDelegate:self];
[_imagePickerController
setAllowsEditing:NO];
[self
addChildViewController:_imagePickerController];
[self.view
addSubview:_imagePickerController.view];
if ([GNDevice
versionPermit:7
second:0]) {
[[UIApplication
sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];
} else {
[[UIApplication
sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent];
}
}
然后在delegate里写上
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
if ([GNDevice
versionPermit:7
second:0]) {
[[UIApplication
sharedApplication] setStatusBarHidden:NO];
[[UIApplication
sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];
} else {
//其实就是加了这个动画
[UIView
animateWithDuration:0.4
animations:^{
[[UIApplication
sharedApplication] setStatusBarHidden:YES];
} completion:^(BOOL finished) {
[[UIApplication
sharedApplication] setStatusBarHidden:NO];
}];
}
UIView *custom = [[UIView
alloc] initWithFrame:CGRectMake(0,0,0,0)];
UIBarButtonItem *btn = [[UIBarButtonItem
alloc] initWithCustomView:custom];
[viewController.navigationItem
setRightBarButtonItem:btn animated:NO];
viewController.title =
@"扫 一
扫";
if ([GNDevice
versionPermit:7
second:0]) {
//下面这段话如果在IOS5上运行的话会显示有点问题,所以这个地方注释
NSDictionary *attributes=[NSDictionary
dictionaryWithObjectsAndKeys:[UIColor
blackColor],UITextAttributeTextColor,[UIFont
boldSystemFontOfSize:20],UITextAttributeFont,
nil];
[viewController.navigationController.navigationBar
setTitleTextAttributes:attributes];
}
[btn release];
[custom release];
}
#pragma mark Methods
- (void)initImagePickerControllerInterface
{
if (!_imagePickerController) {
_imagePickerController = [[UIImagePickerController
alloc] init];
}
[_imagePickerController
setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
[_imagePickerController
setDelegate:self];
[_imagePickerController
setAllowsEditing:NO];
[self
addChildViewController:_imagePickerController];
[self.view
addSubview:_imagePickerController.view];
if ([GNDevice
versionPermit:7
second:0]) {
[[UIApplication
sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];
} else {
[[UIApplication
sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent];
}
}
然后在delegate里写上
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
if ([GNDevice
versionPermit:7
second:0]) {
[[UIApplication
sharedApplication] setStatusBarHidden:NO];
[[UIApplication
sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];
} else {
//其实就是加了这个动画
[UIView
animateWithDuration:0.4
animations:^{
[[UIApplication
sharedApplication] setStatusBarHidden:YES];
} completion:^(BOOL finished) {
[[UIApplication
sharedApplication] setStatusBarHidden:NO];
}];
}
UIView *custom = [[UIView
alloc] initWithFrame:CGRectMake(0,0,0,0)];
UIBarButtonItem *btn = [[UIBarButtonItem
alloc] initWithCustomView:custom];
[viewController.navigationItem
setRightBarButtonItem:btn animated:NO];
viewController.title =
@"扫 一
扫";
if ([GNDevice
versionPermit:7
second:0]) {
//下面这段话如果在IOS5上运行的话会显示有点问题,所以这个地方注释
NSDictionary *attributes=[NSDictionary
dictionaryWithObjectsAndKeys:[UIColor
blackColor],UITextAttributeTextColor,[UIFont
boldSystemFontOfSize:20],UITextAttributeFont,
nil];
[viewController.navigationController.navigationBar
setTitleTextAttributes:attributes];
}
[btn release];
[custom release];
}
相关文章推荐
- 关于将系统自带的UIImagePickerController 作为uitabbarcontroller时 present时出现问题的解决
- 调用系统UIImagePickerController录像并保存到指定的文件夹,解决保存后播放视频角度偏移90度问题
- Qt for iOS:使用UIImagePickerController获取一个系统相册中的图片
- iOS开发中使用相机或系统相册的一些问题总结(UIImagePickerController)
- 使用线程加载UIImagePickerController,解决卡屏问题
- IOS-解决自定义UIImagePickerController 后的图片翻转问题
- 使用UIImagePickerController时3DTouch引起的Crash问题的解决--备用
- 解决Swift中present(uiImagePickerController,animated: true,completion: nil)闪退的问题
- 使用线程加载UIImagePickerController,解决卡屏问题
- 如何去除系统自带的UIImagePickerController 右侧的取消按钮
- iOS App内存优化之 解决UIImagePickerController的图片对象占用RAM过高问题
- 使用UIImagePickerController时3DTouch引起的Crash问题的解决
- 一个NFS缓存管理包的bug导致文件系统满的问题和解决方法
- 解决nginx作为前端代理默认访问一个80端口虚拟主机配置问题
- 一个关于MFMessageComposeViewController的ios7中的诡异问题 收件人视图黑色 和解决方式
- 调用系统UIImagePickerController录像并保存到指定的文件夹
- 关于UIImagePickerController 被dismiss 后 屏幕顶部弹出红条 的问题
- Python:通过自定义系统级快捷键来控制程序开始或停止记录日志(使用小技巧解决一个貌似无解的问题)
- 解决网吧多种配置同用一个系统蓝屏问题
- Connector 作为一个Java项目解决的问题