2.12-3.20上周的习惯坚持下来了✌️精诚所至金石为开,加油兄弟

妹妹婚礼,祝福妹妹,幸福的新娘子,下周yy过来,但是任务比较重,跟同事搞好关系,跟峰哥商量好,要是实在不行,找人帮忙搞一下,周末没办法加班了

block反向传值,代替代理跳转弄明白了,在pop的时候调用dealloc说明控制器没有内存泄露

QQ好友列表,点击headerView收起分组,使用block替换代理,

遇到崩溃的问题,exc_bad_access 

野指针

正确的使用步骤:

1.在headerView的类中声明一个block属性,

//  HeaderView.h

typedef void(^headerViewClicked)();

@interface HeaderView : UITableViewHeaderFooterView

@property (nonatomic, copy) headerViewClicked headerClicked;

2.在点击headerView调用的方法中执行block   headerClicked()

//  HeaderView.m

UITapGestureRecognizer *tapGest = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(headerViewDidClicked:)];//headerViewDidClicked:用Block属性

-(void)headerViewDidClicked:(headerViewClicked)headerViewClicked {

    //--------------用block方法

//    _headerClicked = headerViewClicked; // 没有赋值,不能使用,会崩溃

    //----------用block属性 之前block已经赋值好

    self.sectionNameModel.showCell = !self.sectionNameModel.showCell;

    if (_headerClicked) {

        _headerClicked();

    }

}

 

3.在控制器中给headerView的Block属性赋值

//  SectionTableViewController.m

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {

    HeaderView *headerView = [[HeaderView alloc]init];

    headerView.sectionNameModel = self.sectionNameArray[section];

    headerView.tag = section;

    

    __weak __typeof(self)weakSelf = self;

    //------------------------------------用block方法

//    NSIndexSet *set = [NSIndexSet indexSetWithIndex:headerView.tag];

//    [headerView headerViewDidClicked:^{

//        NSLog(@"*******************");

//        [weakSelf.tableView reloadSections:set withRowAnimation:UITableViewRowAnimationFade];

//    }];

    

    //------------------------------------用block属性

    NSIndexSet *set = [NSIndexSet indexSetWithIndex:headerView.tag];

    headerView.headerClicked = ^(){

        NSLog(@"*******************");

        [weakSelf.tableView reloadSections:set withRowAnimation:UITableViewRowAnimationFade];

        

    };

    

    return headerView;

}

错误的使用步骤:

1.在headerView的类中声明一个block属性,

2.在headerView的类中声明一个带block的方法,headerViewDidClicked:

3.在点击headerView调用的方法(headerViewDidClicked:)中执行block   headerClicked(),修改模型显示隐藏bool

4.在控制器中调用headerView的带Block的方法

 

正确的使用步骤:

1.在headerView的类中声明一个block属性,

2.在headerView的类中声明一个带block的方法,headerViewDidClicked:

- (void) headerViewDidClicked:(headerViewClicked)headerViewClicked;

3.在点击headerView调用的方法(另外一个方法)(showOrHide)中执行block   headerClicked(),修改模型显示隐藏bool

//  HeaderView.m

UITapGestureRecognizer *tapGest = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(showOrHide)];

-(void)headerViewDidClicked:(headerViewClicked)headerViewClicked {    

    //--------------用block方法

    _headerClicked = headerViewClicked; // 没有赋值,不能使用,会崩溃

}

- (void)showOrHide{ // 用block方法

    self.sectionNameModel.showCell = !self.sectionNameModel.showCell;

    if (_headerClicked) {

        _headerClicked();

    }

}

4.在控制器中调用headerView带Block的方法

//  SectionTableViewController.m

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {

    HeaderView *headerView = [[HeaderView alloc]init];

    headerView.sectionNameModel = self.sectionNameArray[section];

    headerView.tag = section;

    

    __weak __typeof(self)weakSelf = self;

    //------------------------------------用block方法

    NSIndexSet *set = [NSIndexSet indexSetWithIndex:headerView.tag];

    [headerView headerViewDidClicked:^{

        NSLog(@"*******************");

        [weakSelf.tableView reloadSections:set withRowAnimation:UITableViewRowAnimationFade];

    }];    

    return headerView;

}

------------------------------------------

git公钥

svedeMacBook-Air:.ssh sve$ cat id_rsa.pub

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDZ3hjA/+E+53hfOV9ufoT5L+bpzQtXjocksgXVq1j4tT9PC1cwe4jg42X+NMFHw/lM9wz6zWknanC+iG4iiT4B5wwybRZ/pBHmiPrkaaGTuo8AqccwekGgMuic9zyhM2u1LbiG8Px5hS1X8ToyOM7tMWpvTW6Tib3nZiSc0R7I6GRE50PJrGC33DBQJT/0gE5WEE82mNzFgXCKZv81fnCriYyySvwLpKmc+GynCWMSoRILjA5+2Yxe07UYVPSzRebfKMr/eEJfwQHY7xWobI4Oa4q9UjbQFUE5f+up18pqxTuz9c28tUSFJqofnsUUZXFmFkdEegaKLw+zkQhqgiCl songximing@haodf.com

svedeMacBook-Air:.ssh sve$ 

---------------------------------------------------------------------------

[[HDFSearchBarView alloc] initWithFrame:(CGRect){CGPointZero, SCREEN_WIDTH, 44} delegate:self]

--------

Bundle 

 

-----------------------------------------------------------------------------------------------------

粗心的错误,textField一直出不来,后来发现黄色的写成了backGroundView ,给backGroundView 加约束

UITextField *telInputTextField = [[UITextField alloc]init];

    [backGroundView addSubview:telInputTextField];

    [telInputTextField mas_makeConstraints:^(MASConstraintMaker *make) {

        make.top.equalTo(backGroundView.mas_top);

        make.bottom.equalTo(backGroundView.mas_bottom);

        make.left.equalTo(phoneLabel.mas_right).offset(0);

        make.right.equalTo(backGroundView.mas_right).offset(-10);

    }];

-----------------------------------------------------------------------------------------------------

三个大view一直出不来

----------------------------------------------------------------------------------------------------

block反向传值后,直接跳转了控制器,没停留,旧代码没删除

在第二个控制器定义block属性,在点击方法中执行这个Block

在第一个控制器中给block赋值

----------------------------------------------------------------------------------------------------

textField收起

leeGof

------------------------------------------------------------------------------------------------

上面的写法不能设置按钮的文字,必须用下面的Set方法才能设置按钮文字

//    hdfServeAgreementButton.titleLabel.text = @"好大夫服务协议";

    [hdfServeAgreementButton setTitle:@"好大夫服务协议" forState:UIControlStateNormal];

------------------------------------------------------------------------------------------------

loadView

storyBoard

.xib

viewController.xib

空view

所以得干掉xib才能不显示xib

 

-----

 //    if (self.isFromAddNewPatient) {

        myPatientId = self.patientInfoView.patientModel.patientId;

        //    }else{

        //        myPatientId = self.patientModel.patientId;

        //    }

干啥的判断?是新添加的患者还是从患者列表选选择的患者

-----

记录一下:ios 6中以前一直没注意,textField原来文字默认是顶对齐,额,,用ios 6现在测才发现,,,不居中不好看啊,

更改如下:

   [textField setContentVerticalAlignment:UIControlContentVerticalAlignmentCenter];

 

在pop的时候没有走dealloc

ENFullScreenPicker.h滚轮picker

 

doctorAppDelegate *doctorDelegate = (doctorAppDelegate *)[UIApplication  sharedApplication].delegate; 获取APPdelegate

双布尔值搞定,点击

原文地址:https://www.cnblogs.com/tufei7/p/5300442.html