JXNewFriendToSearVc.m 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. //
  2. // JXCommonInputVC.m
  3. // shiku_im
  4. //
  5. // Created by p on 2019/4/1.
  6. // Copyright © 2019年 Reese. All rights reserved.
  7. //
  8. #import "JXNewFriendToSearVc.h"
  9. #define HEIGHT 44
  10. #define STARTTIME_TAG 1
  11. #define IMGSIZE 100
  12. @interface JXNewFriendToSearVc ()<UITextFieldDelegate>
  13. @end
  14. @implementation JXNewFriendToSearVc
  15. - (void)viewDidLoad {
  16. [super viewDidLoad];
  17. // Do any additional setup after loading the view.
  18. self.isGotoBack = YES;
  19. self.title = self.titleStr;
  20. self.heightFooter = 0;
  21. self.heightHeader = JX_SCREEN_TOP;
  22. //self.view.frame = CGRectMake(0, 0, JX_SCREEN_WIDTH, JX_SCREEN_HEIGHT);
  23. [self createHeadAndFoot];
  24. int h = 0;
  25. JXImageView *iv = [self createButton:self.subTitle drawTop:NO drawBottom:YES must:NO click:nil];
  26. iv.frame = CGRectMake(0, h, JX_SCREEN_WIDTH, HEIGHT);
  27. _name = [self createTextField:iv default:nil hint:self.tip];
  28. [_name becomeFirstResponder];
  29. h+=iv.frame.size.height;
  30. h+=30;
  31. UIButton* _btn;
  32. _btn = [UIFactory createCommonButton:self.btnTitle target:self action:@selector(onSearch)];
  33. _btn.custom_acceptEventInterval = .25f;
  34. _btn.layer.masksToBounds = YES;
  35. _btn.layer.cornerRadius = 7.f;
  36. _btn.frame = CGRectMake(15, h, JX_SCREEN_WIDTH-30, 40);
  37. [self.tableBody addSubview:_btn];
  38. }
  39. - (void)onSearch {
  40. [self actionQuit];
  41. if ([self.delegate respondsToSelector:@selector(commonInputVCBtnActionWithVC:)]) {
  42. [self.delegate commonInputVCBtnActionWithVC:self];
  43. }
  44. }
  45. - (void)hideKeyboard{
  46. }
  47. -(JXImageView*)createButton:(NSString*)title drawTop:(BOOL)drawTop drawBottom:(BOOL)drawBottom must:(BOOL)must click:(SEL)click{
  48. JXImageView* btn = [[JXImageView alloc] init];
  49. btn.backgroundColor = [UIColor whiteColor];
  50. btn.userInteractionEnabled = YES;
  51. btn.delegate = self;
  52. if(click)
  53. btn.didTouch = click;
  54. else
  55. btn.didTouch = @selector(hideKeyboard);
  56. [self.tableBody addSubview:btn];
  57. // [btn release];
  58. if(must){
  59. UILabel* p = [[UILabel alloc] initWithFrame:CGRectMake(INSETS, 5, 20, HEIGHT-5)];
  60. p.text = @"*";
  61. p.font = g_factory.font18;
  62. p.backgroundColor = [UIColor clearColor];
  63. p.textColor = [UIColor redColor];
  64. p.textAlignment = NSTextAlignmentCenter;
  65. [btn addSubview:p];
  66. // [p release];
  67. }
  68. JXLabel* p = [[JXLabel alloc] initWithFrame:CGRectMake(20, 0, JX_SCREEN_WIDTH/2-40, HEIGHT)];
  69. p.text = title;
  70. p.font = g_factory.font16;
  71. p.backgroundColor = [UIColor clearColor];
  72. p.textColor = [UIColor blackColor];
  73. [btn addSubview:p];
  74. // [p release];
  75. if(drawTop){
  76. UIView* line = [[UIView alloc] initWithFrame:CGRectMake(0,0,JX_SCREEN_WIDTH,LINE_WH)];
  77. line.backgroundColor = THE_LINE_COLOR;
  78. [btn addSubview:line];
  79. // [line release];
  80. }
  81. if(drawBottom){
  82. UIView* line = [[UIView alloc]initWithFrame:CGRectMake(0,HEIGHT-LINE_WH,JX_SCREEN_WIDTH,LINE_WH)];
  83. line.backgroundColor = THE_LINE_COLOR;
  84. [btn addSubview:line];
  85. // [line release];
  86. }
  87. if(click){
  88. UIImageView* iv;
  89. iv = [[UIImageView alloc] initWithFrame:CGRectMake(JX_SCREEN_WIDTH-15-7, (HEIGHT-13)/2, 7, 13)];
  90. iv.image = [UIImage imageNamed:@"new_icon_>"];
  91. [btn addSubview:iv];
  92. // [iv release];
  93. }
  94. return btn;
  95. }
  96. -(UITextField*)createTextField:(UIView*)parent default:(NSString*)s hint:(NSString*)hint{
  97. UITextField* p = [[UITextField alloc] initWithFrame:CGRectMake(JX_SCREEN_WIDTH/2,INSETS,JX_SCREEN_WIDTH/2-15,HEIGHT-INSETS*2)];
  98. p.delegate = self;
  99. p.autocorrectionType = UITextAutocorrectionTypeNo;
  100. p.autocapitalizationType = UITextAutocapitalizationTypeNone;
  101. p.enablesReturnKeyAutomatically = YES;
  102. p.borderStyle = UITextBorderStyleNone;
  103. p.returnKeyType = UIReturnKeyDone;
  104. p.clearButtonMode = UITextFieldViewModeWhileEditing;
  105. p.textAlignment = NSTextAlignmentRight;
  106. p.userInteractionEnabled = YES;
  107. p.text = s;
  108. p.placeholder = hint;
  109. p.font = g_factory.font16;
  110. [parent addSubview:p];
  111. // [p release];
  112. return p;
  113. }
  114. /*
  115. #pragma mark - Navigation
  116. // In a storyboard-based application, you will often want to do a little preparation before navigation
  117. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  118. // Get the new view controller using [segue destinationViewController].
  119. // Pass the selected object to the new view controller.
  120. }
  121. */
  122. @end