GXFBaseSearchViewController.m 2.9 KB
Newer Older
freecui's avatar
freecui committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
//
//  GXFBaseSearchViewController.m
//  XFFruit
//
//  Created by freecui on 15/9/1.
//  Copyright (c) 2015年 Xummer. All rights reserved.
//

#define BACKGROUND_CLOLOR HexColor(@"f8f8f8");



#import "GXFBaseSearchViewController.h"

@interface GXFBaseSearchViewController ()

@end

@implementation GXFBaseSearchViewController
- (instancetype)initWithSubViews {
    self = [super init];
    if (!self) {
        return nil;
    }
    UIBarButtonItem *rightItem = [[UIBarButtonItem alloc]initWithTitle:@"确定" style:UIBarButtonItemStylePlain target:self action:@selector(sureClick)];
    self.navigationItem.rightBarButtonItem = rightItem;
    
    self.f_textFiled = [[UITextField alloc]initWithFrame:CGRectMake(20, 5, self.view.width - 20 * 2, TopMargin - 10)];
    self.f_textFiled.textAlignment = NSTextAlignmentLeft;
    self.f_textFiled.background = [UIImage imageNamed:@"textFiled"];
    self.f_textFiled.font = FontSize(15);
    [self.view addSubview:_f_textFiled];
    
    UIImageView *leftImgV = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 35, 40)];
    leftImgV.image = [UIImage imageNamed:@"search"];
    self.f_textFiled.leftView = leftImgV;
    self.f_textFiled.leftViewMode = UITextFieldViewModeAlways;
    
    UIButton *rightBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [rightBtn setImage:[UIImage imageNamed:@"delete"] forState:UIControlStateNormal];
    rightBtn.frame = CGRectMake(0, 0, 35, 40);
    [rightBtn addTarget:self action:@selector(deleteClicked) forControlEvents:UIControlEventTouchUpInside];
    self.f_textFiled.rightView = rightBtn;
    self.f_textFiled.rightViewMode = UITextFieldViewModeAlways;
    self.view.backgroundColor = BACKGROUND_CLOLOR;
    
//    self.f_tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, TopMargin, self.view.width, self.view.height - TopMargin - NavigationBarHeight) style:UITableViewStylePlain];
//    [self.view addSubview:_f_tableView];
  
    
    return self;
}

- (void)sureClick {
    if ([_delegate respondsToSelector:@selector(baseSearchViewControllernClickedNavigationRightButton)]) {
        [_delegate baseSearchViewControllernClickedNavigationRightButton];
    }
}

- (void)deleteClicked {
    if ([_delegate respondsToSelector:@selector(baseSearchViewControllerClickedDelegateButton)]) {
        [_delegate baseSearchViewControllernClickedNavigationRightButton];
    }
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#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