Commit d0792c43 authored by admin's avatar admin

修复添加新问题 可以拍照或选择本地图片

parent 7fbcb01a
......@@ -39,6 +39,8 @@
@property (nonatomic, strong) UIActionSheet *categoryActionSheet;
@property (nonatomic, strong) UIActionSheet *questionActionSheet;
@property (nonatomic, strong) UIActionSheet *selectActionSheet;
@property (nonatomic ,strong) UILabel *selectLabel;
@property (nonatomic ,strong) UILabel *selectLabel1;
@property (nonatomic, assign) int rowNumber;
......@@ -135,21 +137,15 @@
- (void)createImagePicker:(UIButton *)sender
{
self.selectActionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:nil otherButtonTitles:@"直接拍照上传", @"从本地相册选择", nil];
_selectActionSheet.delegate = self;
_selectActionSheet.tag = 999283;
[_selectActionSheet showInView:self.view];
if (sender.tag == 2201) {
_rowNumber++;
}
if (![UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"找不到相机" delegate:nil cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
[alert show];
} else {
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.modalTransitionStyle=UIModalTransitionStyleFlipHorizontal;
picker.videoQuality = UIImagePickerControllerQualityTypeLow;
[self presentViewController:picker animated:YES completion:nil];
}
}
......@@ -512,13 +508,37 @@
- (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex
{
if (actionSheet.tag == 999283) {
if (buttonIndex == 0) {
if (![UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"找不到相机" delegate:nil cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
[alert show];
} else {
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.modalTransitionStyle=UIModalTransitionStyleFlipHorizontal;
picker.videoQuality = UIImagePickerControllerQualityTypeLow;
[self presentViewController:picker animated:YES completion:nil];
}
} else if (buttonIndex == 1){
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
picker.delegate = self;
//设置选择后的图片可被编辑
picker.allowsEditing = YES;
[self presentViewController:picker animated:YES completion:nil];
}
}
if (actionSheet == _categoryActionSheet) {
if (buttonIndex < [NSArray arrayWithObjects:CATEGORYLIST].count) {
_selectLabel.text = [[NSArray arrayWithObjects:CATEGORYLIST] objectAtIndex:buttonIndex];
[_saveDict setObject:[[NSArray arrayWithObjects:CATEGORYLIST] objectAtIndex:buttonIndex] forKey:@"selectLabel"];
}
} else {
} else if (actionSheet == _questionActionSheet){
if (buttonIndex < [NSArray arrayWithObjects:QUESTIONLIST].count) {
_selectLabel1.text = [[NSArray arrayWithObjects:QUESTIONLIST] objectAtIndex:buttonIndex];
[_saveDict setObject:[[NSArray arrayWithObjects:QUESTIONLIST] objectAtIndex:buttonIndex] forKey:@"selectLabel1"];
......
......@@ -112,7 +112,7 @@
NSDictionary *parameters = @{@"user":user_uuid,
@"scope":@"all",
@"pageNumber":@(0),
@"pageSize":@(10)
@"pageSize":@(20)
};
// 发起请求
......
......@@ -368,7 +368,7 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
NSDictionary *parameters = @{@"user":user_uuid,
@"scope":@"all",
@"pageNumber":@(0),
@"pageSize":@(2)
@"pageSize":@(10)
};
// 发起请求
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment