OrdertakingViewController.m 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. //
  2. // OrdertakingViewController.m
  3. // jitao
  4. //
  5. // Created by 罗云飞 on 2017/12/16.
  6. // Copyright © 2017年 罗云飞. All rights reserved.
  7. //
  8. #import "OrdertakingViewController.h"
  9. @interface OrdertakingViewController ()<UITextViewDelegate>{
  10. UITextView *textview;
  11. }
  12. @end
  13. @implementation OrdertakingViewController
  14. - (void)viewDidLoad {
  15. [super viewDidLoad];
  16. self.view.backgroundColor = NewNavigationColor;
  17. [self setNavTitle:@"接单"];
  18. [self loadsview];
  19. // Do any additional setup after loading the view.
  20. }
  21. - (void)loadsview {
  22. UIView *view = [UIView new];
  23. view.backgroundColor = NewWhiteColor;
  24. ViewRadius(view, 3);
  25. [self.view addSubview:view];
  26. view.sd_layout
  27. .leftSpaceToView(self.view, 15)
  28. .topSpaceToView(self.view, NavHeader+10)
  29. .rightSpaceToView(self.view, 15)
  30. .heightIs(70);
  31. UILabel *title = [UILabel new];
  32. title.text = @"风力发电领域内高效率变惯量飞轮蓄电机组研究应";
  33. title.font = NewFont(14);
  34. [title setSingleLineAutoResizeWithMaxWidth:0];
  35. [view addSubview:title];
  36. title.sd_layout
  37. .leftSpaceToView(view, 15)
  38. .topSpaceToView(view, 15)
  39. .heightIs(14);
  40. UILabel *ordernumber = [UILabel new];
  41. ordernumber.text = [NSString stringWithFormat:@"订单编号:%@",@"0000001"];
  42. ordernumber.font = NewFont(11);
  43. ordernumber.textColor = NewButtonColor;
  44. [ordernumber setSingleLineAutoResizeWithMaxWidth:0];
  45. [view addSubview:ordernumber];
  46. ordernumber.sd_layout
  47. .leftEqualToView(title)
  48. .heightIs(11)
  49. .bottomSpaceToView(view, 15);
  50. UILabel *time = [UILabel new];
  51. time.text = @"2011-11-11 11:22:22";
  52. time.font = NewFont(10);
  53. time.textColor = NewNavigationColor;
  54. [time setSingleLineAutoResizeWithMaxWidth:0];
  55. [view addSubview:time];
  56. time.sd_layout
  57. .rightSpaceToView(view, 15)
  58. .bottomEqualToView(ordernumber)
  59. .heightIs(8);
  60. UIView *view1 = [UIView new];
  61. view1.backgroundColor = NewWhiteColor;
  62. ViewRadius(view1, 3);
  63. [self.view addSubview:view1];
  64. view1.sd_layout
  65. .leftSpaceToView(self.view, 15)
  66. .heightIs(100)
  67. .rightSpaceToView(self.view, 15)
  68. .topSpaceToView(view, 1);
  69. UILabel *content = [UILabel new];
  70. content.text = @"本项目处于国内高技术前沿,原创性特征明显,对提升中国结构一体化复合材料的高技术研发水平和创新能力具有艾薇阿辉就...";
  71. content.font = NewFont(12);
  72. content.textColor = [UIColor colorWithString:@"#9A9A9A"];
  73. content.lineBreakMode = NSLineBreakByTruncatingTail;
  74. content.numberOfLines = 2;
  75. [view1 addSubview:content];
  76. content.sd_layout
  77. .leftSpaceToView(view1, 15)
  78. .topSpaceToView(view1, 15)
  79. .rightSpaceToView(view1, 15)
  80. .heightIs(30);
  81. UILabel *technicaltype = [UILabel new];
  82. technicaltype.text = [NSString stringWithFormat:@"技术类型:%@",@"医药生物"];
  83. technicaltype.font = NewFont(11);
  84. technicaltype.textColor = NewButtonColor;
  85. [technicaltype setSingleLineAutoResizeWithMaxWidth:0];
  86. [view1 addSubview:technicaltype];
  87. technicaltype.sd_layout
  88. .leftEqualToView(content)
  89. .heightIs(11)
  90. .topSpaceToView(content, 15);
  91. UILabel *qiatan = [UILabel new];
  92. qiatan.text = @"洽谈:";
  93. [qiatan setSingleLineAutoResizeWithMaxWidth:0];
  94. qiatan.font = NewFont(12);
  95. [view1 addSubview:qiatan];
  96. qiatan.sd_layout
  97. .leftEqualToView(technicaltype)
  98. .heightIs(12)
  99. .topSpaceToView(technicaltype, 10);
  100. UILabel*daynumber = [UILabel new];
  101. daynumber.text = [NSString stringWithFormat:@"%@天",@"34"];
  102. daynumber.font = NewBFont(12);
  103. daynumber.textColor = [UIColor colorWithString:@"#FF8523"];
  104. [daynumber setSingleLineAutoResizeWithMaxWidth:0];
  105. [view1 addSubview:daynumber];
  106. daynumber.sd_layout
  107. .leftSpaceToView(qiatan, 5)
  108. .heightIs(11)
  109. .centerYEqualToView(qiatan);
  110. UILabel *xuansan = [UILabel new];
  111. xuansan.text = @"悬赏:";
  112. xuansan.font = NewFont(12);
  113. [xuansan setSingleLineAutoResizeWithMaxWidth:0];
  114. [view1 addSubview:xuansan];
  115. xuansan.sd_layout
  116. .leftSpaceToView(daynumber, 24)
  117. .heightIs(12)
  118. .centerYEqualToView(daynumber);
  119. UILabel*rewardamount = [UILabel new];
  120. rewardamount.text = [NSString stringWithFormat:@"%@万",@"34"];
  121. rewardamount.font = NewBFont(12);
  122. rewardamount.textColor = [UIColor colorWithString:@"#FF8523"];
  123. [rewardamount setSingleLineAutoResizeWithMaxWidth:0];
  124. [view1 addSubview:rewardamount];
  125. rewardamount.sd_layout
  126. .leftSpaceToView(xuansan, 5)
  127. .heightIs(11)
  128. .centerYEqualToView(xuansan);
  129. UIImageView *followimage = [UIImageView new];
  130. [followimage setImage:[UIImage imageNamed:@"关注"]];
  131. [view1 addSubview:followimage];
  132. followimage.sd_layout
  133. .rightSpaceToView(view1, 15)
  134. .centerYEqualToView(rewardamount)
  135. .heightIs(16)
  136. .widthIs(16);
  137. UILabel *follownumber = [UILabel new];
  138. follownumber.text = @"26";
  139. [follownumber setSingleLineAutoResizeWithMaxWidth:0];
  140. follownumber.textColor = [UIColor colorWithString:@"#9A9A9A"];
  141. follownumber.font = NewFont(12);
  142. [view1 addSubview:follownumber];
  143. follownumber.sd_layout
  144. .rightSpaceToView(followimage, 3)
  145. .heightIs(10)
  146. .centerYEqualToView(followimage);
  147. UILabel *place = [UILabel new];
  148. place.text = @"湖南长沙";
  149. place.textColor = [UIColor colorWithString:@"#9A9A9A"];
  150. place.font = NewFont(11);
  151. [place setSingleLineAutoResizeWithMaxWidth:0];
  152. [view1 addSubview:place];
  153. place.sd_layout
  154. .rightSpaceToView(follownumber, 20)
  155. .heightIs(11)
  156. .centerYEqualToView(follownumber);
  157. textview = [[UITextView alloc] init];
  158. textview.font = NewFont(12);
  159. textview.textColor = NewGrayColor;
  160. textview.backgroundColor = NewWhiteColor;
  161. textview.delegate = self;
  162. textview.text= @"请备注留言,以便服务人员能更好的了解你的意向~";
  163. ViewBorderRadius(textview, 5, 1, NewClearColor);
  164. [self.view addSubview:textview];
  165. textview.sd_layout
  166. .leftSpaceToView(self.view, 15)
  167. .rightSpaceToView(self.view, 15)
  168. .heightIs(133)
  169. .topSpaceToView(view1, 24);
  170. UIButton *submit = [UIButton new];
  171. [submit setTitle:@"提交接单意向" forState:UIControlStateNormal];
  172. [submit setTitleColor:NewWhiteColor forState:UIControlStateNormal];
  173. submit.titleLabel.font = NewFont(15);
  174. submit.backgroundColor = NewButtonColor;
  175. ViewRadius(submit, 8);
  176. [self.view addSubview:submit];
  177. submit.sd_layout
  178. .leftSpaceToView(self.view, 50)
  179. .rightSpaceToView(self.view, 50)
  180. .heightIs(50)
  181. .topSpaceToView(textview, 30);
  182. }
  183. #pragma mark - UITextView获得焦点之后,并且已经是第一响应者
  184. -(void)textViewDidBeginEditing:(UITextView *)textView
  185. {
  186. // NSLog(@"UITextView获得焦点之后,并且已经是第一响应者");
  187. if ([textView.text isEqualToString:@"请备注留言,以便服务人员能更好的了解你的意向~"]) {
  188. textView.text = @"";
  189. textView.textColor = NewGrayColor;
  190. }
  191. }
  192. #pragma mark - UITextView失去焦点之后
  193. -(void)textViewDidEndEditing:(UITextView *)textView
  194. {
  195. //NSLog(@"UITextView失去焦点");
  196. if ([textView.text isEqualToString:@""] || textView.text.length == 0) {
  197. textView.text = @"请备注留言,以便服务人员能更好的了解你的意向~";
  198. textView.textColor = NewRGBColor(199, 199, 205, 1);
  199. }
  200. }
  201. #pragma mark - 详细地址限制字数
  202. -(void)textViewDidChangeSelection:(UITextView *)textView
  203. {
  204. if(textView.text.length > 100){
  205. textView.text = [textView.text substringWithRange:NSMakeRange(0,100)];
  206. }
  207. if (textView.text.length > 0) {
  208. NSLog(@"textView.text:%@",textView.text);
  209. // publishcontent = nil;
  210. // publishcontent = textView.text;
  211. }
  212. }
  213. - (void)didReceiveMemoryWarning {
  214. [super didReceiveMemoryWarning];
  215. // Dispose of any resources that can be recreated.
  216. }
  217. /*
  218. #pragma mark - Navigation
  219. // In a storyboard-based application, you will often want to do a little preparation before navigation
  220. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  221. // Get the new view controller using [segue destinationViewController].
  222. // Pass the selected object to the new view controller.
  223. }
  224. */
  225. @end