Commit e190d8e9 authored by admin's avatar admin

完成star的打分

parent f46f452d
......@@ -60,6 +60,9 @@
84E420511BE89D9A00689976 /* InspectTaskSortCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 84E420501BE89D9A00689976 /* InspectTaskSortCell.m */; };
84F1669B1BE715E40061D350 /* ZanButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 84F1669A1BE715E40061D350 /* ZanButton.m */; };
84F57C461BEC388A00DDEEB1 /* CommentView.m in Sources */ = {isa = PBXBuildFile; fileRef = 84F57C451BEC388A00DDEEB1 /* CommentView.m */; };
84F57C4C1BEC785E00DDEEB1 /* AddQuestionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 84F57C4B1BEC785E00DDEEB1 /* AddQuestionViewController.m */; };
84F57C501BEC7AA300DDEEB1 /* AddQuestionFooterView.m in Sources */ = {isa = PBXBuildFile; fileRef = 84F57C4F1BEC7AA300DDEEB1 /* AddQuestionFooterView.m */; };
84F57C9C1BECA73800DDEEB1 /* StarBar.m in Sources */ = {isa = PBXBuildFile; fileRef = 84F57C9B1BECA73800DDEEB1 /* StarBar.m */; };
84FD89F21BD9FC71006E442A /* HomeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 84FD89F11BD9FC71006E442A /* HomeViewController.m */; };
84FD8A071BDA01C4006E442A /* ChartViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 84FD8A061BDA01C4006E442A /* ChartViewController.m */; };
84FD8A0A1BDA01D1006E442A /* MineViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 84FD8A091BDA01D1006E442A /* MineViewController.m */; };
......@@ -194,6 +197,12 @@
84F1669A1BE715E40061D350 /* ZanButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZanButton.m; sourceTree = "<group>"; };
84F57C441BEC388A00DDEEB1 /* CommentView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommentView.h; sourceTree = "<group>"; };
84F57C451BEC388A00DDEEB1 /* CommentView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CommentView.m; sourceTree = "<group>"; };
84F57C4A1BEC785E00DDEEB1 /* AddQuestionViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AddQuestionViewController.h; sourceTree = "<group>"; };
84F57C4B1BEC785E00DDEEB1 /* AddQuestionViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AddQuestionViewController.m; sourceTree = "<group>"; };
84F57C4E1BEC7AA300DDEEB1 /* AddQuestionFooterView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AddQuestionFooterView.h; sourceTree = "<group>"; };
84F57C4F1BEC7AA300DDEEB1 /* AddQuestionFooterView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AddQuestionFooterView.m; sourceTree = "<group>"; };
84F57C9A1BECA73800DDEEB1 /* StarBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StarBar.h; sourceTree = "<group>"; };
84F57C9B1BECA73800DDEEB1 /* StarBar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StarBar.m; sourceTree = "<group>"; };
84FD89F01BD9FC71006E442A /* HomeViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HomeViewController.h; sourceTree = "<group>"; };
84FD89F11BD9FC71006E442A /* HomeViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HomeViewController.m; sourceTree = "<group>"; };
84FD8A051BDA01C4006E442A /* ChartViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChartViewController.h; sourceTree = "<group>"; };
......@@ -348,6 +357,7 @@
8426A4AA1BDF0CD600E5FDF5 /* Question */ = {
isa = PBXGroup;
children = (
84F57C471BEC782D00DDEEB1 /* AddQuestion */,
8474C5861BE78A85007DCF19 /* QuestionDetail */,
8474C5891BE78A85007DCF19 /* QuestionList */,
);
......@@ -707,6 +717,7 @@
84970E261BD8DEFE00C1728A /* Tools */ = {
isa = PBXGroup;
children = (
84F57C991BECA72C00DDEEB1 /* StarBar */,
8474C5801BE751A2007DCF19 /* CommonFunc */,
84F166981BE715D20061D350 /* ZanButton */,
84DB9BC11BDCD49900822CC4 /* CustomDropMenu */,
......@@ -910,6 +921,50 @@
path = View;
sourceTree = "<group>";
};
84F57C471BEC782D00DDEEB1 /* AddQuestion */ = {
isa = PBXGroup;
children = (
84F57C4D1BEC7A8C00DDEEB1 /* View */,
84F57C481BEC784A00DDEEB1 /* Cell */,
84F57C491BEC784A00DDEEB1 /* ViewController */,
);
path = AddQuestion;
sourceTree = "<group>";
};
84F57C481BEC784A00DDEEB1 /* Cell */ = {
isa = PBXGroup;
children = (
);
path = Cell;
sourceTree = "<group>";
};
84F57C491BEC784A00DDEEB1 /* ViewController */ = {
isa = PBXGroup;
children = (
84F57C4A1BEC785E00DDEEB1 /* AddQuestionViewController.h */,
84F57C4B1BEC785E00DDEEB1 /* AddQuestionViewController.m */,
);
path = ViewController;
sourceTree = "<group>";
};
84F57C4D1BEC7A8C00DDEEB1 /* View */ = {
isa = PBXGroup;
children = (
84F57C4E1BEC7AA300DDEEB1 /* AddQuestionFooterView.h */,
84F57C4F1BEC7AA300DDEEB1 /* AddQuestionFooterView.m */,
);
path = View;
sourceTree = "<group>";
};
84F57C991BECA72C00DDEEB1 /* StarBar */ = {
isa = PBXGroup;
children = (
84F57C9A1BECA73800DDEEB1 /* StarBar.h */,
84F57C9B1BECA73800DDEEB1 /* StarBar.m */,
);
path = StarBar;
sourceTree = "<group>";
};
84FD89ED1BD9FC5B006E442A /* Home */ = {
isa = PBXGroup;
children = (
......@@ -1182,6 +1237,7 @@
84970DEF1BD8DD8A00C1728A /* main.m in Sources */,
8474A01C1BE368D700315F30 /* HomeCellItem.m in Sources */,
84D8257F1BDD2F7E00CC61F7 /* MineTableFooterView.m in Sources */,
84F57C501BEC7AA300DDEEB1 /* AddQuestionFooterView.m in Sources */,
84CF0F1E1BE9B40400C855CE /* InspectDetailFooterView.m in Sources */,
84970E281BD8DEFE00C1728A /* AppDelegate.m in Sources */,
84AB20A51BE648EC00B66F13 /* PictureViewController.m in Sources */,
......@@ -1198,6 +1254,8 @@
8474C5921BE78A85007DCF19 /* QuestionViewController.m in Sources */,
8408261E1BE5D22A0022B795 /* OnLineTableViewCell.m in Sources */,
8408261A1BE5CEDD0022B795 /* OnLineViewController.m in Sources */,
84F57C9C1BECA73800DDEEB1 /* StarBar.m in Sources */,
84F57C4C1BEC785E00DDEEB1 /* AddQuestionViewController.m in Sources */,
84CF0ED51BE9AC1400C855CE /* InspectSettleCell.m in Sources */,
84C957551BDB54D600083584 /* AnnounceViewController.m in Sources */,
84C9574D1BDB344900083584 /* UIBarButtonItem+Create.m in Sources */,
......
No preview for this file type
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "close@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "close@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
redstar/Assets.xcassets/Inspect/close.imageset/close@2x.png

1.49 KB

redstar/Assets.xcassets/Inspect/close.imageset/close@3x.png

1.84 KB

{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "star_after@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "star_after@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
redstar/Assets.xcassets/Inspect/star_after.imageset/star_after@2x.png

1.88 KB

redstar/Assets.xcassets/Inspect/star_after.imageset/star_after@3x.png

2.34 KB

{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "star_before@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "star_before@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
redstar/Assets.xcassets/Inspect/star_before.imageset/star_before@2x.png

2.53 KB

redstar/Assets.xcassets/Inspect/star_before.imageset/star_before@3x.png

3.44 KB

......@@ -7,6 +7,7 @@
//
#import <UIKit/UIKit.h>
#import "StarBar.h"
@interface CommentView : UIView <UITextViewDelegate>
@property (nonatomic, strong) UILabel *titleLabel;
......@@ -18,4 +19,6 @@
@property (nonatomic, strong) UIButton *sureBtn;
@property (nonatomic, strong) StarBar *starBar;
@end
......@@ -8,6 +8,7 @@
#import "CommentView.h"
#define kStarBarWidth 235
@interface CommentView ()
@property (nonatomic, strong) UILabel *placeholderLabel2;
......@@ -54,6 +55,8 @@
[self.sureBtn setTitle:@"确定" forState:UIControlStateNormal];
self.starBar.starNumber = 0;
}
#pragma mark - UITextView Delegate
......@@ -151,8 +154,8 @@
[self addConstraint:titleLeft];
// 右边
NSLayoutConstraint *titleRight = [NSLayoutConstraint constraintWithItem:_starLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[self addConstraint:titleRight];
NSLayoutConstraint *titleWidth = [NSLayoutConstraint constraintWithItem:_starLabel attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:65];
[self addConstraint:titleWidth];
// 右边
NSLayoutConstraint *titleHeight = [NSLayoutConstraint constraintWithItem:_starLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:30];
......@@ -298,4 +301,14 @@
return _sureBtn;
}
- (StarBar *)starBar
{
if (!_starBar) {
_starBar = [[StarBar alloc] initWithFrame:CGRectMake(kScreenWidth - kStarBarWidth, 55, kStarBarWidth, 30)];
[self addSubview:_starBar];
}
return _starBar;
}
@end
......@@ -116,7 +116,7 @@
if (kScreenHeight == 480) {
_footView = [[OnLineFooterView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 400)];
} else {
_footView = [[OnLineFooterView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, (kScreenHeight - 100 - 63))];
_footView = [[OnLineFooterView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, (kScreenHeight - 100 - 64))];
}
[_footView.saveButton addTarget:self action:@selector(saveClick:) forControlEvents:UIControlEventTouchUpInside];
}
......
//
// AddQuestionFooterView.h
// redstar
//
// Created by admin on 15/11/6.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "TakePhotoView.h"
@interface AddQuestionFooterView : UIView
@property (nonatomic, strong) UITextView *titleTextView;
@property (nonatomic, strong) TakePhotoView *takePhotoView;
@end
//
// AddQuestionFooterView.m
// redstar
//
// Created by admin on 15/11/6.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "AddQuestionFooterView.h"
#define kTakePhotoX 0
#define kTakePhotoY 175
#define kTakePhotoWidth (kScreenWidth - kTakePhotoX * 2)
#define kTakePhotoHeight 130 // 待处理
@interface AddQuestionFooterView () <UITextViewDelegate>
@property (nonatomic, strong) UIImageView *backImageView1;
@property (nonatomic, strong) UILabel *placeholderLabel1;
@end
@implementation AddQuestionFooterView
- (instancetype)init
{
self = [super init];
if (self) {
[self setup];
}
return self;
}
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self setup];
}
return self;
}
- (void)setup
{
self.backgroundColor = kFootViewBackGroundColor;
UILabel *titleLabel = [[UILabel alloc] init];
titleLabel.translatesAutoresizingMaskIntoConstraints = NO;
titleLabel.font = [UIFont systemFontOfSize:16.0];
titleLabel.text = @"问题与建议描述";
titleLabel.textColor = kOnLineCellTitleColor;
[self addSubview:titleLabel];
NSLayoutConstraint *titleTop = [NSLayoutConstraint constraintWithItem:titleLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
[self addConstraint:titleTop];
NSLayoutConstraint *titleLeft = [NSLayoutConstraint constraintWithItem:titleLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self addConstraint:titleLeft];
NSLayoutConstraint *titleRight = [NSLayoutConstraint constraintWithItem:titleLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[self addConstraint:titleRight];
NSLayoutConstraint *titleHeight = [NSLayoutConstraint constraintWithItem:titleLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:50];
[self addConstraint:titleHeight];
UIImage *image = [UIImage imageNamed:@"textbox"];
UIImage *resizingName = [image resizableImageWithCapInsets:UIEdgeInsetsMake(1, 1, 24, 24) resizingMode:UIImageResizingModeStretch];
self.backImageView1.image = resizingName;
self.titleTextView.backgroundColor = [UIColor clearColor];
self.placeholderLabel1.text = @"请输入文字...";
self.takePhotoView.backgroundColor = kSectionBackGroundColor;
}
#pragma mark - UITextView Delegate
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text {
if (![text isEqualToString:@""]) {
_placeholderLabel1.hidden = YES;
}
if ([text isEqualToString:@""] && range.location == 0 && range.length == 1) {
_placeholderLabel1.hidden = NO;
}
return YES;
}
#pragma mark - lazy loading
- (UIImageView *)backImageView1
{
if (!_backImageView1) {
_backImageView1 = [[UIImageView alloc] init];
_backImageView1.userInteractionEnabled = YES;
_backImageView1.translatesAutoresizingMaskIntoConstraints = NO;
[self addSubview:_backImageView1];
NSLayoutConstraint *contentTop = [NSLayoutConstraint constraintWithItem:_backImageView1 attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeTop multiplier:1.0 constant:50];
[self addConstraint:contentTop];
NSLayoutConstraint *contentLeft = [NSLayoutConstraint constraintWithItem:_backImageView1 attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self addConstraint:contentLeft];
NSLayoutConstraint *contentRight = [NSLayoutConstraint constraintWithItem:_backImageView1 attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[self addConstraint:contentRight];
NSLayoutConstraint *contentHeight = [NSLayoutConstraint constraintWithItem:_backImageView1 attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:120];
[self addConstraint:contentHeight];
}
return _backImageView1;
}
- (UITextView *)titleTextView
{
if (!_titleTextView) {
_titleTextView = [[UITextView alloc] init];
_titleTextView.tag = 1001;
_titleTextView.delegate = self;
_titleTextView.font = [UIFont systemFontOfSize:15.0];
_titleTextView.translatesAutoresizingMaskIntoConstraints = NO;
[self.backImageView1 addSubview:_titleTextView];
NSLayoutConstraint *contentTop = [NSLayoutConstraint constraintWithItem:_titleTextView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.backImageView1 attribute:NSLayoutAttributeTop multiplier:1.0 constant:1];
[self.backImageView1 addConstraint:contentTop];
NSLayoutConstraint *contentLeft = [NSLayoutConstraint constraintWithItem:_titleTextView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.backImageView1 attribute:NSLayoutAttributeLeft multiplier:1.0 constant:1];
[self.backImageView1 addConstraint:contentLeft];
NSLayoutConstraint *contentRight = [NSLayoutConstraint constraintWithItem:_titleTextView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.backImageView1 attribute:NSLayoutAttributeRight multiplier:1.0 constant:-1];
[self.backImageView1 addConstraint:contentRight];
NSLayoutConstraint *contentHeight = [NSLayoutConstraint constraintWithItem:_titleTextView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.backImageView1 attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-1];
[self.backImageView1 addConstraint:contentHeight];
}
return _titleTextView;
}
- (UILabel *)placeholderLabel1
{
if (!_placeholderLabel1) {
_placeholderLabel1 = [[UILabel alloc] init];
_placeholderLabel1.translatesAutoresizingMaskIntoConstraints = NO;
_placeholderLabel1.font = [UIFont systemFontOfSize:15.0];
_placeholderLabel1.textColor = kOnLineCellDetailColor;
[self.titleTextView addSubview:_placeholderLabel1];
NSLayoutConstraint *contentTop = [NSLayoutConstraint constraintWithItem:_placeholderLabel1 attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.titleTextView attribute:NSLayoutAttributeTop multiplier:1.0 constant:2];
[self.titleTextView addConstraint:contentTop];
NSLayoutConstraint *contentLeft = [NSLayoutConstraint constraintWithItem:_placeholderLabel1 attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.titleTextView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:5];
[self.titleTextView addConstraint:contentLeft];
NSLayoutConstraint *contentRight = [NSLayoutConstraint constraintWithItem:_placeholderLabel1 attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.titleTextView attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[self.titleTextView addConstraint:contentRight];
NSLayoutConstraint *contentHeight = [NSLayoutConstraint constraintWithItem:_placeholderLabel1 attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:30];
[self.titleTextView addConstraint:contentHeight];
}
return _placeholderLabel1;
}
- (TakePhotoView *)takePhotoView
{
if (!_takePhotoView) {
_takePhotoView = [[TakePhotoView alloc] initWithFrame:CGRectMake(kTakePhotoX, kTakePhotoY, kTakePhotoWidth, kTakePhotoHeight)];
[self addSubview:_takePhotoView];
}
return _takePhotoView;
}
@end
//
// AddQuestionViewController.h
// redstar
//
// Created by admin on 15/11/6.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AddQuestionViewController : UIViewController
@end
//
// AddQuestionViewController.m
// redstar
//
// Created by admin on 15/11/6.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "AddQuestionViewController.h"
#import "OnLineTableViewCell.h"
#import "AddQuestionFooterView.h"
#import "CheckPicViewController.h"
#define kAddQuestionCell @"addQuestionTableViewCell"
@interface AddQuestionViewController () <UITableViewDelegate, UITableViewDataSource, TakePhotoDelegate>
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) AddQuestionFooterView *footerView;
@property (nonatomic, strong) NSArray *titleArray;
@end
@implementation AddQuestionViewController
- (void)viewDidLoad
{
[super viewDidLoad];
UILabel *customLab = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 40, 30)];
[customLab setTextColor:[UIColor whiteColor]];
[customLab setText:@"新问题提报"];
customLab.font = [UIFont boldSystemFontOfSize:19];
self.navigationItem.titleView = customLab;
self.titleArray = [NSArray arrayWithObjects:@"选择对应专业组", @"选择问题分类", nil];
[self addTableView];
// takePhoto按钮点击事件
[self.footerView.takePhotoView.btn addTarget:self action:@selector(addNew:) forControlEvents:UIControlEventTouchUpInside];
self.footerView.takePhotoView.delegate = self;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - Private Methods
- (void)addTableView
{
[self.tableView registerClass:[OnLineTableViewCell class] forCellReuseIdentifier:kAddQuestionCell];
self.tableView.tableFooterView = self.footerView;
}
- (void)addNew:(UIButton *)sender
{
if (![self.footerView.takePhotoView deleClose:sender]) {
self.footerView.takePhotoView.editTag = -1;
if (![UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
UIAlertView* alert = [[UIAlertView alloc] initWithTitle:nil message:@"Unable to find the camera" delegate:nil cancelButtonTitle:nil otherButtonTitles:@"OK", nil];
[alert show];
} else {
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self.footerView.takePhotoView;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.modalTransitionStyle=UIModalTransitionStyleFlipHorizontal;
picker.videoQuality = UIImagePickerControllerQualityTypeLow;
[self presentViewController:picker animated:YES completion:nil];
}
}
}
#pragma mark - TakePhoto Delegate
- (void)takePhotoShowPicture:(UIButton *)btn
{
CheckPicViewController *checkVC = [[CheckPicViewController alloc] init];
checkVC.checkImage = btn.imageView.image;
[self.navigationController pushViewController:checkVC animated:YES];
}
#pragma mark - TableView Delegate/DateSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return _titleArray.count;
}
// cell显示的内容
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
OnLineTableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:kAddQuestionCell];
if (!cell) {
cell = [[OnLineTableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kAddQuestionCell];
}
cell.titleLabel.text = [NSString stringWithFormat:@"%@", _titleArray[indexPath.row]];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell;
}
// cell的高度
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 50;
}
#pragma mark - lazy loading
- (UITableView *)tableView
{
if (!_tableView) {
_tableView = [[UITableView alloc] initWithFrame:CGRectZero];
_tableView.translatesAutoresizingMaskIntoConstraints = NO;
_tableView.delegate = self;
_tableView.dataSource = self;
_tableView.showsVerticalScrollIndicator = NO;
_tableView.showsHorizontalScrollIndicator = NO;
[self.view addSubview:_tableView];
NSLayoutConstraint *tableTop = [NSLayoutConstraint constraintWithItem:_tableView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
[self.view addConstraint:tableTop];
NSLayoutConstraint *tableLeft = [NSLayoutConstraint constraintWithItem:_tableView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self.view addConstraint:tableLeft];
NSLayoutConstraint *tableRight = [NSLayoutConstraint constraintWithItem:_tableView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[self.view addConstraint:tableRight];
NSLayoutConstraint *tableBottom = [NSLayoutConstraint constraintWithItem:_tableView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.view addConstraint:tableBottom];
}
return _tableView;
}
- (AddQuestionFooterView *)footerView
{
if (!_footerView) {
if (kScreenHeight == 480) {
_footerView = [[AddQuestionFooterView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 400)];
} else {
_footerView = [[AddQuestionFooterView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, (kScreenHeight - 100 - 64))];
}
}
return _footerView;
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
......@@ -11,6 +11,8 @@
#import "MenuButton.h"
#import "QuestionDetailViewController.h"
#import "AddQuestionViewController.h"
#import <AFNetworking.h>
#define kQuestionListCell @"questionListTableViewCell"
......@@ -82,7 +84,8 @@
- (void)addClick:(UIButton *)sender
{
AddQuestionViewController *addQuestionVC = [[AddQuestionViewController alloc] init];
[self.navigationController pushViewController:addQuestionVC animated:YES];
}
#pragma mark - UItableView Delegate/DataSource
......
//
// StarBar.h
// redstar
//
// Created by admin on 15/11/6.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface StarBar : UIView
@property (nonatomic,assign) NSInteger starNumber; // 默认显示亮的星星
@property (nonatomic,assign) BOOL enable; // 是否可以触摸
@end
//
// StarBar.m
// redstar
//
// Created by admin on 15/11/6.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "StarBar.h"
#define ZOOM 0.7f
@interface StarBar ()
@property (nonatomic,strong) UIView *bottomView;
@property (nonatomic,strong) UIView *topView;
@property (nonatomic,assign) CGFloat starWidth;
@end
@implementation StarBar
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
self.backgroundColor = [UIColor whiteColor];
self.userInteractionEnabled = YES;
self.bottomView = [[UIView alloc] initWithFrame:self.bounds];
self.bottomView.userInteractionEnabled = NO;
[self addSubview:self.bottomView];
self.topView = [[UIView alloc] initWithFrame:CGRectZero];
self.topView.clipsToBounds = YES;
self.topView.userInteractionEnabled = NO;
[self addSubview:self.topView];
// 添加手势
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tap:)];
UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(pan:)];
[self addGestureRecognizer:tap];
[self addGestureRecognizer:pan];
CGFloat width = frame.size.width/7.0;
self.starWidth = width;
for(int i = 0;i<5;i++){
UIImageView *img = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, frame.size.height * ZOOM, frame.size.height * ZOOM)];
img.center = CGPointMake((i+1.5)*width, frame.size.height/2);
img.image = [UIImage imageNamed:@"star_before"];
[self.bottomView addSubview:img];
UIImageView *img2 = [[UIImageView alloc] initWithFrame:img.frame];
img2.center = img.center;
img2.image = [UIImage imageNamed:@"star_after"];
[self.topView addSubview:img2];
}
self.enable = YES;
}
return self;
}
- (void)setStarNumber:(NSInteger)starNumber
{
if (_starNumber != starNumber) {
_starNumber = starNumber;
self.topView.frame = CGRectMake(0, 0, self.starWidth*(starNumber+1), self.bounds.size.height);
}
}
- (void)tap:(UITapGestureRecognizer *)gesture
{
if (self.enable) {
CGPoint point = [gesture locationInView:self];
NSInteger count = (int)(point.x / self.starWidth)+1;
self.topView.frame = CGRectMake(0, 0, self.starWidth * count, self.bounds.size.height);
if (count > 5) {
_starNumber = 5;
} else {
_starNumber = count - 1;
}
}
}
- (void)pan:(UIPanGestureRecognizer *)gesture
{
if (self.enable) {
CGPoint point = [gesture locationInView:self];
NSInteger count = (int)(point.x/self.starWidth);
if (count >= 0 && count <= 5 && _starNumber != count) {
self.topView.frame = CGRectMake(0, 0, self.starWidth * (count + 1), self.bounds.size.height);
_starNumber = count;
}
}
}
@end
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