Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
O
Opple-iOS
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张杰
Opple-iOS
Commits
b8d74198
Commit
b8d74198
authored
May 26, 2016
by
勾芒
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://git.oschina.net/gomore/Opple-iOS
parents
3682188e
b12a93ed
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
121 additions
and
85 deletions
+121
-85
CameraView.h
Lighting/Class/CameraView.h
+12
-1
CameraView.m
Lighting/Class/CameraView.m
+23
-64
FollowHeartViewController.h
Lighting/Class/FollowHeartViewController.h
+1
-1
FollowHeartViewController.m
Lighting/Class/FollowHeartViewController.m
+9
-10
LoginViewController.m
Lighting/Class/Login/LoginViewController.m
+2
-2
NSObject+UIImagePickerController.h
Lighting/Class/NSObject+UIImagePickerController.h
+1
-1
NSObject+UIImagePickerController.m
Lighting/Class/NSObject+UIImagePickerController.m
+12
-4
DeviceDirectionManager.h
Lighting/Class/tools/DeviceDirectionManager.h
+14
-0
DeviceDirectionManager.m
Lighting/Class/tools/DeviceDirectionManager.m
+22
-0
project.pbxproj
Lighting/Lighting.xcodeproj/project.pbxproj
+6
-0
AppDelegate.h
Lighting/Lighting/AppDelegate.h
+1
-1
AppDelegate.m
Lighting/Lighting/AppDelegate.m
+18
-1
No files found.
Lighting/Class/CameraView.h
View file @
b8d74198
...
...
@@ -7,8 +7,19 @@
//
#import "BaseViewController.h"
#import "DeviceDirectionManager.h"
@protocol
AddCustomPicturedelegate
<
NSObject
>
@required
//回调
-
(
void
)
addCustomPictureImage
:
(
UIImage
*
)
image
;
@end
@interface
CameraView
:
BaseViewController
<
UIGestureRecognizerDelegate
,
UIImagePickerControllerDelegate
,
UINavigationControllerDelegate
>
@property
(
nonatomic
,
assign
)
id
<
AddCustomPicturedelegate
>
delegate
;
@property
(
nonatomic
,
strong
)
UIView
*
subView
;
@property
(
nonatomic
,
strong
)
UI
PopoverController
*
popoverController
;
@property
(
nonatomic
,
strong
)
UI
Image
*
customImage
;
@end
Lighting/Class/CameraView.m
View file @
b8d74198
...
...
@@ -26,7 +26,6 @@
_imagePickerController
.
delegate
=
self
;
_imagePickerController
.
modalTransitionStyle
=
UIModalTransitionStyleFlipHorizontal
;
_imagePickerController
.
allowsEditing
=
YES
;
// [_imagePickerController supportedInterfaceOrientations];
[
self
initView
];
// Do any additional setup after loading the view.
}
...
...
@@ -74,24 +73,13 @@
switch
(
sender
.
tag
)
{
case
101
:
//拍照
{
// UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
// if ([UIImagePickerController isSourceTypeAvailable:
// UIImagePickerControllerSourceTypePhotoLibrary]) {
// imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
// imagePicker.delegate = self;
// [imagePicker setAllowsEditing:YES];
// UIPopoverController *popover = [[UIPopoverController alloc] initWithContentViewController:imagePicker];
// self.popoverController = popover;
// [self presentViewController:imagePicker animated:YES completion:nil];
//// [self.popoverController presentPopoverFromRect:CGRectMake(0, 0, 800, 500) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
//
// }
// [self selectImageFromAlbum];
[
self
selectImageFromCamera
];
}
break
;
case
102
:
//从相册中选取
{
[
self
selectImageFromAlbum
];
}
break
;
case
103
:
//取消
...
...
@@ -110,71 +98,47 @@
-
(
void
)
selectImageFromCamera
{
_imagePickerController
.
sourceType
=
UIImagePickerControllerSourceTypeCamera
;
//录制视频时长,默认10s
_imagePickerController
.
videoMaximumDuration
=
15
;
//相机类型(拍照、录像...)字符串需要做相应的类型转换
_imagePickerController
.
mediaTypes
=
@[(
NSString
*
)
kUTTypeMovie
,(
NSString
*
)
kUTTypeImage
];
//视频上传质量
//UIImagePickerControllerQualityTypeHigh高清
//UIImagePickerControllerQualityTypeMedium中等质量
//UIImagePickerControllerQualityTypeLow低质量
//UIImagePickerControllerQualityType640x480
_imagePickerController
.
videoQuality
=
UIImagePickerControllerQualityTypeHigh
;
//
设置摄像头模式(拍照,录制视频)为录像模式
_imagePickerController
.
cameraCaptureMode
=
UIImagePickerControllerCameraCaptureModeVideo
;
//
在打开相机之前,设置屏幕为支持竖屏
[
DeviceDirectionManager
instance
].
isHorizontal
=
YES
;
[
self
presentViewController
:
_imagePickerController
animated
:
YES
completion
:
nil
];
}
#pragma mark 从相册获取图片
或视频
#pragma mark 从相册获取图片
-
(
void
)
selectImageFromAlbum
{
//NSLog(@"相册");
_imagePickerController
.
sourceType
=
UIImagePickerControllerSourceTypePhotoLibrary
;
//在打开相册之前,设置屏幕为支持竖屏
[
DeviceDirectionManager
instance
].
isHorizontal
=
YES
;
[
self
presentViewController
:
_imagePickerController
animated
:
YES
completion
:
nil
];
}
#pragma mark UIImagePickerControllerDelegate
//该代理方法仅适用于只选取图片时
-
(
void
)
imagePickerController
:
(
UIImagePickerController
*
)
picker
didFinishPickingImage
:
(
UIImage
*
)
image
editingInfo
:
(
nullable
NSDictionary
<
NSString
*
,
id
>
*
)
editingInfo
{
NSLog
(
@"选择完毕----image:%@-----info:%@"
,
image
,
editingInfo
);
}
//适用获取所有媒体资源,只需判断资源类型
-
(
void
)
imagePickerController
:
(
UIImagePickerController
*
)
picker
didFinishPickingMediaWithInfo
:
(
NSDictionary
<
NSString
*
,
id
>
*
)
info
{
NSString
*
mediaType
=
[
info
objectForKey
:
UIImagePickerControllerMediaType
];
//判断资源类型
if
([
mediaType
isEqualToString
:(
NSString
*
)
kUTTypeImage
]){
//如果是图片
// self.imageView.image = info[UIImagePickerControllerEditedImage];
// //压缩图片
// NSData *fileData = UIImageJPEGRepresentation(self.imageView.image, 1.0);
// //保存图片至相册
// UIImageWriteToSavedPhotosAlbum(self.imageView.image, self, @selector(image:didFinishSavingWithError:contextInfo:), NULL);
// //上传图片
// [self uploadImageWithData:fileData];
self
.
customImage
=
info
[
UIImagePickerControllerEditedImage
];
if
([
self
.
delegate
respondsToSelector
:
@selector
(
addCustomPictureImage
:)])
{
[
self
.
delegate
addCustomPictureImage
:
self
.
customImage
];
}
}
else
{
//如果是视频
NSURL
*
url
=
info
[
UIImagePickerControllerMediaURL
];
//播放视频
// _moviePlayer.contentURL = url;
// [_moviePlayer play];
//保存视频至相册(异步线程)
NSString
*
urlStr
=
[
url
path
];
dispatch_async
(
dispatch_get_global_queue
(
DISPATCH_QUEUE_PRIORITY_DEFAULT
,
0
),
^
{
if
(
UIVideoAtPathIsCompatibleWithSavedPhotosAlbum
(
urlStr
))
{
UISaveVideoAtPathToSavedPhotosAlbum
(
urlStr
,
self
,
@selector
(
video
:
didFinishSavingWithError
:
contextInfo
:
),
nil
);
}
});
NSData
*
videoData
=
[
NSData
dataWithContentsOfURL
:
url
];
//视频上传
// [self uploadVideoWithData:videoData];
}
[
self
dismissViewControllerAnimated
:
YES
completion
:
nil
];
[
DeviceDirectionManager
instance
].
isHorizontal
=
NO
;
}
-
(
void
)
imagePickerControllerDidCancel
:
(
UIImagePickerController
*
)
picker
{
[
self
dismissViewControllerAnimated
:
YES
completion
:
nil
];
[
DeviceDirectionManager
instance
].
isHorizontal
=
NO
;
}
#pragma mark 图片保存完毕的回调
-
(
void
)
image
:
(
UIImage
*
)
image
didFinishSavingWithError
:
(
NSError
*
)
error
contextInfo
:
(
void
*
)
contextInf
{
...
...
@@ -189,11 +153,6 @@
NSLog
(
@"视频保存成功."
);
}
}
//支持横屏
-
(
NSUInteger
)
supportedInterfaceOrientations
{
return
UIInterfaceOrientationMaskLandscape
;
}
//取消按钮
-
(
void
)
DismissScreenView
{
...
...
Lighting/Class/FollowHeartViewController.h
View file @
b8d74198
...
...
@@ -24,7 +24,7 @@
@end
@interface
FollowHeartViewController
:
BaseViewController
<
LeftViewBtnClickdelegate
,
RightViewBtnClickdelegate
,
FootViewBtnClickdelegate
,
UIGestureRecognizerDelegate
,
AddSecenePicturedelegate
,
AddProductPicturedelegate
,
SharePicturedelegate
>
@interface
FollowHeartViewController
:
BaseViewController
<
LeftViewBtnClickdelegate
,
RightViewBtnClickdelegate
,
FootViewBtnClickdelegate
,
UIGestureRecognizerDelegate
,
AddSecenePicturedelegate
,
AddProductPicturedelegate
,
SharePicturedelegate
,
AddCustomPicturedelegate
>
@property
(
nonatomic
,
assign
)
id
<
FollowHeartViewAddpicturedelegate
>
delegate
;
@property
(
nonatomic
,
strong
)
LeftSubView
*
leftSubView
;
@property
(
nonatomic
,
strong
)
RightSubView
*
rightSubView
;
...
...
Lighting/Class/FollowHeartViewController.m
View file @
b8d74198
...
...
@@ -112,25 +112,24 @@
{
self
.
cameraView
=
[[
CameraView
alloc
]
init
];
self
.
cameraView
.
view
.
backgroundColor
=
[
UIColor
clearColor
];
// //
self.cameraView.delegate=self;
self
.
cameraView
.
delegate
=
self
;
[
self
.
view
addSubview
:
self
.
cameraView
.
view
];
// [SHARED_APPDELEGATE.window.rootViewController.view addSubview: self.cameraView.view];
// UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"ceshi" message:@"shide " preferredStyle:UIAlertControllerStyleAlert];
// [self presentViewController:alertController animated:YES completion:nil];
}
//场景赋图回调
//自定义场景附图回调
-
(
void
)
addCustomPictureImage
:
(
UIImage
*
)
image
{
[
self
.
footSubView
addFootSubViewImage
:
image
];
self
.
backGroundImageView
.
image
=
image
;
}
//添加场景图
-
(
void
)
resetSuperBackGroundImage
:
(
UIImage
*
)
image
{
self
.
backGroundImageView
.
image
=
image
;
}
//
产品附图回调
//
添加产品图
-
(
void
)
resetSubProductImage
:
(
UIImage
*
)
image
productModel
:
(
NSMutableArray
*
)
productModel
{
ImageCropperView
*
cropper
=
[[
ImageCropperView
alloc
]
initWithFrame
:
CGRectMake
(
400
,
300
,
300
,
300
)];
// cropper.layer.borderWidth = 1.0;
// cropper.layer.borderColor = [UIColor blueColor].CGColor;
cropper
.
image
=
image
;
[
self
.
view
addSubview
:
cropper
];
}
...
...
Lighting/Class/Login/LoginViewController.m
View file @
b8d74198
...
...
@@ -100,8 +100,8 @@
#pragma mark -登陆
-
(
IBAction
)
LoginButtonClick
:
(
UIButton
*
)
sender
{
//
[self SetTheRootViewController];
//
return;
[
self
SetTheRootViewController
];
return
;
if
(
self
.
userName
.
text
.
length
==
0
)
{
[
self
ErrorMBProgressView
:
@"用户名不能为空"
];
...
...
Lighting/Class/NSObject+UIImagePickerController.h
View file @
b8d74198
...
...
@@ -9,5 +9,5 @@
#import <Foundation/Foundation.h>
@interface
NSObject
(
UIImagePickerController
)
-
(
NSUInteger
)
supportedInterfaceOrientations
;
@end
Lighting/Class/NSObject+UIImagePickerController.m
View file @
b8d74198
...
...
@@ -10,10 +10,10 @@
@implementation
NSObject
(
UIImagePickerController
)
//指定 UIImagePickerController只支持横屏
-
(
NSUInteger
)
supportedInterfaceOrientations
{
return
UIInterfaceOrientationMaskLandscape
;
}
//
-(NSUInteger)supportedInterfaceOrientations
//
{
//
return UIInterfaceOrientationMaskLandscape;
//
}
//设置状态栏
-
(
UIStatusBarStyle
)
preferredStatusBarStyle
{
...
...
@@ -23,4 +23,12 @@
{
return
YES
;
}
-
(
BOOL
)
shouldAutorotate
{
return
YES
;
}
-
(
NSUInteger
)
supportedInterfaceOrientations
{
return
UIInterfaceOrientationMaskAll
;
}
@end
Lighting/Class/tools/DeviceDirectionManager.h
0 → 100644
View file @
b8d74198
//
// DeviceDirectionManager.h
// Lighting
//
// Created by mac on 16/5/26.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface
DeviceDirectionManager
:
NSObject
@property
(
nonatomic
,
assign
)
BOOL
isHorizontal
;
//是否是横屏
+
(
DeviceDirectionManager
*
)
instance
;
@end
Lighting/Class/tools/DeviceDirectionManager.m
0 → 100644
View file @
b8d74198
//
// DeviceDirectionManager.m
// Lighting
//
// Created by mac on 16/5/26.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import "DeviceDirectionManager.h"
//支持横竖屏单例
@implementation
DeviceDirectionManager
+
(
DeviceDirectionManager
*
)
instance
{
static
dispatch_once_t
onceToken
;
static
DeviceDirectionManager
*
_instance
=
nil
;
dispatch_once
(
&
onceToken
,
^
{
_instance
=
[[
DeviceDirectionManager
alloc
]
init
];
});
assert
(
_instance
!=
nil
);
return
_instance
;
}
@end
Lighting/Lighting.xcodeproj/project.pbxproj
View file @
b8d74198
...
...
@@ -23,6 +23,7 @@
04F9EE1B1CF22B5900BD729F
/* ShoppingCell.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04F9EE1A1CF22B5900BD729F
/* ShoppingCell.m */
;
};
04F9EE1E1CF25F7300BD729F
/* ShareViewController.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04F9EE1D1CF25F7300BD729F
/* ShareViewController.m */
;
};
04F9EE221CF27B1D00BD729F
/* CoreTelephony.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04F9EE211CF27B1D00BD729F
/* CoreTelephony.framework */
;
};
04FCB1A41CF60A8F0056093B
/* DeviceDirectionManager.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04FCB1A31CF60A8F0056093B
/* DeviceDirectionManager.m */
;
};
060D397C1CE45CFE0082AECD
/* ImageCropperView.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
060D39791CE45CFE0082AECD
/* ImageCropperView.m */
;
};
060D397D1CE45CFE0082AECD
/* UIImage+Rotation.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
060D397B1CE45CFE0082AECD
/* UIImage+Rotation.m */
;
};
2906B5D71CD89246000849B4
/* ClientDetailsTableViewCell.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
2906B5D61CD89246000849B4
/* ClientDetailsTableViewCell.m */
;
};
...
...
@@ -170,6 +171,8 @@
04F9EE1D1CF25F7300BD729F
/* ShareViewController.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
ShareViewController.m
;
sourceTree
=
"<group>"
;
};
04F9EE1F1CF27AF900BD729F
/* SystemConfiguration.framework */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
wrapper.framework
;
name
=
SystemConfiguration.framework
;
path
=
System/Library/Frameworks/SystemConfiguration.framework
;
sourceTree
=
SDKROOT
;
};
04F9EE211CF27B1D00BD729F
/* CoreTelephony.framework */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
wrapper.framework
;
name
=
CoreTelephony.framework
;
path
=
System/Library/Frameworks/CoreTelephony.framework
;
sourceTree
=
SDKROOT
;
};
04FCB1A21CF60A8F0056093B
/* DeviceDirectionManager.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
DeviceDirectionManager.h
;
sourceTree
=
"<group>"
;
};
04FCB1A31CF60A8F0056093B
/* DeviceDirectionManager.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
DeviceDirectionManager.m
;
sourceTree
=
"<group>"
;
};
060D39781CE45CFE0082AECD
/* ImageCropperView.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
ImageCropperView.h
;
sourceTree
=
"<group>"
;
};
060D39791CE45CFE0082AECD
/* ImageCropperView.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
ImageCropperView.m
;
sourceTree
=
"<group>"
;
};
060D397A1CE45CFE0082AECD
/* UIImage+Rotation.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
"UIImage+Rotation.h"
;
sourceTree
=
"<group>"
;
};
...
...
@@ -497,6 +500,8 @@
060D39791CE45CFE0082AECD
/* ImageCropperView.m */
,
060D397A1CE45CFE0082AECD
/* UIImage+Rotation.h */
,
060D397B1CE45CFE0082AECD
/* UIImage+Rotation.m */
,
04FCB1A21CF60A8F0056093B
/* DeviceDirectionManager.h */
,
04FCB1A31CF60A8F0056093B
/* DeviceDirectionManager.m */
,
);
path
=
tools
;
sourceTree
=
"<group>"
;
...
...
@@ -1471,6 +1476,7 @@
29BFBD8F1CE44BA900C238FB
/* goodsDetailsSectionview.m in Sources */
,
294CF0EC1CEDCF480055F1D8
/* PromptinformationView.m in Sources */
,
290887131CE5DF16000B7097
/* ShopcarModel.m in Sources */
,
04FCB1A41CF60A8F0056093B
/* DeviceDirectionManager.m in Sources */
,
29BB27681CD9D38E009A0813
/* AllpriceTableViewCell.m in Sources */
,
29BB27771CD9DFBA009A0813
/* ProductLibraryViewController.m in Sources */
,
04F9EE181CF2235000BD729F
/* ShoppingView.m in Sources */
,
...
...
Lighting/Lighting/AppDelegate.h
View file @
b8d74198
...
...
@@ -49,7 +49,7 @@
-
(
void
)
saveContext
;
-
(
NSURL
*
)
applicationDocumentsDirectory
;
-
(
NSUInteger
)
application
:(
UIApplication
*
)
application
supportedInterfaceOrientationsForWindow
:(
nullable
UIWindow
*
)
window
;
@end
Lighting/Lighting/AppDelegate.m
View file @
b8d74198
...
...
@@ -8,6 +8,7 @@
#import "AppDelegate.h"
#import "LoginViewController.h"
#import "DeviceDirectionManager.h"
@interface
AppDelegate
()
@end
...
...
@@ -24,7 +25,23 @@
return
YES
;
}
-
(
NSUInteger
)
application
:(
UIApplication
*
)
application
supportedInterfaceOrientationsForWindow
:(
nullable
UIWindow
*
)
window
{
//判断是否是横屏
if
(
[[
DeviceDirectionManager
instance
]
isHorizontal
])
{
return
UIInterfaceOrientationMaskAll
;
}
else
{
return
UIInterfaceOrientationMaskLandscape
;
}
}
#pragma mark -设置根视图
-
(
void
)
RootViewcontroller
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment