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
總結
以上是生活随笔為你收集整理的2.12-3.20上周的习惯坚持下来了✌️精诚所至金石为开,加油兄弟的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: JavaSE基础(4) JAVA_HOM
- 下一篇: ClickHouse介绍安装和工作原理(