标签:
弹层-成功页面
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
谷歌百度搜索崩溃信息都能找到答案的,问题出在第一句代码,强制转换,但是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解决
------
标签:
原文地址:http://www.cnblogs.com/tufei7/p/5496908.html