標籤:
彈層-成功頁面
jt-二次遊泳-東來順-三裡屯-擁抱-阿迪達斯-牽手-公交站擁抱-電梯口一樓親-到家親
半透明view上面添加白色 alertView 堆砌label, 約束寫好,模型傳文案,根據文案自適應高度 全部堆砌完畢,讓白色View中心跟半透明遮罩背景相同即可
-------
/**
* 求字串長度
*
* @param text 字串
*
* @return 字串寬度
*/
-(float)width:(NSString *)text{
// CGSize size = [text sizeWithFont:[UIFont systemFontOfSize:kCellTextFont]constrainedToSize:CGSizeMake(MAXFLOAT,27)];
CGSize size = [text sizeAutoFitIOS7WithFont:[UIFont systemFontOfSize:kCellTextFont] constrainedToSize:CGSizeMake(MAXFLOAT,27) lineBreakMode:NSLineBreakByCharWrapping];
// LOG(@"text---%@--size.width--%f",text,size.width);
return size.width;
}
-----------
HDFNet *net = [HDFNet shareInstance];
[net postAddPath:DoctorUser_Bookingorder_ModifyTingzhen
parameters:parameters
success:^(HDFNetResponse *response) {
[SVProgressHUD dismiss];
if (_isFromFaceDiaOrderList) {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"發布成功" message:@"如果停診期間已有患者預約,醫助會聯絡患者取消或更換時間" delegate:self cancelButtonTitle:nil otherButtonTitles:@"我知道了", nil];
alertView.tag = kFaceDiaOrderAlertTag;
[alertView show];
}
else{
[SVProgressHUD showSuccessWithStatus:@"發布成功"];
[self performSelector:@selector(popToAnnouceListViewController) withObject:nil afterDelay:0.5];
}
發布成功後,performSelector pop控制器 延遲0.5s
------------------------------------------------------------------------------------------------
先寫上左右的約束, 不寫高度約束,最後加高度約束
// 藍色虛線框imageView
UIImageView *dottedLineImageView = [[UIImageView alloc]init];
[self.bottomContainerView addSubview:dottedLineImageView];
[dottedLineImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.bottomContainerView);
make.left.equalTo(self.bottomContainerView).offset(25);
make.right.equalTo(self.bottomContainerView).offset(-25);
}];
dottedLineImageView.image = [UIImage imageNamed:@"travelDoc_round"];
[dottedLineImageView mas_updateConstraints:^(MASConstraintMaker *make) {
make.bottom.equalTo(rightButton.mas_bottom).offset(15);
}];
-----
scrollview不能滾動
self.bottomContainerView = [[UIView alloc]init];
[self.bgScrollView addSubview:self.bottomContainerView];
[self.bottomContainerView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.offWorkReleaseLabel.mas_bottom).offset(35);
make.left.right.equalTo(self.view);
// make.bottom.equalTo(self.bgScrollView); // 最後再加約束
}];
所有的控制項都應該加到scrollView上.之前第二行寫成了
[self.view addSubview:self.bottomContainerView];
-----
滾動視圖的標準寫法
1.設定四邊約束 所有view添加到scrollView上, 不用設定contentSize, 不用設定代理
UIScrollView *bgScrollView = [[UIScrollView alloc]init];
[self.view addSubview:bgScrollView];
[bgScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self.view);
}];
(如何只設定top.left,right,是不行的,更新約束意味著之前是已經有約束了)
2.更新底邊約束
[bgScrollView mas_updateConstraints:^(MASConstraintMaker *make) {
make.bottom.mas_equalTo(self.bottomContainerView.mas_bottom).offset(15);
}];
-----
font.lineHeight * 0.4
--------------------------------------------------------
@property (nonatomic, strong) id model;
-(void)setModel:(id)model
{
if ([model isKindOfClass:[PTOffLineAnnounceModel class]]) {
_offLineAnnounceModel = model;
}
else if ([model isKindOfClass:[PTOnLineAnnounceModel class]])
{
_onLineAnounceModel = model;
}
[self configureUI];
}
// 一個控制器可能傳兩種模型
--------------------------------------------------------------------------------
先添加UI再用模型重新整理UI
--------------------------------------------------------------------------------
按鈕點擊不能跳轉
因為按鈕的父控制項是圖片,圖片預設是不能互動的,所以設定圖片可互動就行了
----------------------------------------------------------------------------------------------------
崩潰資訊: __NSArrayI removeObject
Google百度搜尋崩潰資訊都能找到答案的,問題出在第一句代碼,強制轉換,但是vcs仍然是不可變數組,至是欺騙了編譯器,實際還是不可變數組,所以
NSMutableArray * vcs = [NSMutableArray arrayWithArray:self.navigationController.viewControllers];
用arrayWithArray寫就不會崩潰了
不同的記憶體空間 相當於alloc init
// 右滑返回
-(void)removeOffLineAnnounceEditViewController{
NSMutableArray * vcs = (NSMutableArray *)self.navigationController.viewControllers;
for (UIViewController * vc in self.navigationController.viewControllers) {
if ([vc isKindOfClass:[OffLineAnnounceEditViewController class]]) {
[vcs removeObject:vc];
[self.navigationController setViewControllers:vcs animated:NO];
// self.navigationController.viewControllers = vcs;
}
}
}
------------------------------------------------------------------------------------------
/**
* 展開圖片,邊緣不變形
*
* @param image 被展開的圖片
*
* @return 展開完畢的圖片
*/
- (UIImage *)strenthImage:(UIImage *)image {
CGFloat top = 31; // 頂端蓋高度
CGFloat bottom = 31 ; // 底端蓋高度
CGFloat left = 10; // 左端蓋寬度
CGFloat right = 10; // 右端蓋寬度
UIEdgeInsets insets = UIEdgeInsetsMake(top, left, bottom, right);
// 指定為展開模式,伸縮後重新賦值
return [image resizableImageWithCapInsets:insets resizingMode:UIImageResizingModeStretch];
}
------------------------------
最後更新約束不對
之前沒有的,可以用make加約束
--------
沒顯示備忘
用scrollView + label解決
------
5.9-停診情境引入出差