0108 灵感1
-
if (nextLabel == nil) {
return;
}
//缩放文字大小的比例
float scale = ABS(scrollView.contentOffset.x / scrollView.bounds.size.width - self.currentIndex);
NSLog(@"%f",scale);
nextLabel.scale = scale;
currentLabel.scale = 1-scale;
-
#import <UIKit/UIKit.h>
@class AppViewModel;
//防止了循环引用 。。。。
@interface appView : UIView
@property(nonatomic,strong)AppViewModel *appViewModel;
+ (id)loadNib;
@end
.m 中的
//重写模型的set方法
- (void)setAppViewModel:(AppViewModel *)appViewModel{
_appViewModel = appViewModel;
self.head.image = [UIImage imageNamed:appViewModel.icon];
self.nameLabel.text = appViewModel.name;
}
+ (id )loadNib{
return [[NSBundle mainBundle]loadNibNamed:@"appView" owner:nil options:nil][0];
}
-
2.9设置透明度,0~1,0代表完全透明,1代表完全不透明
msgLabel.alpha = 0.0; 借此隐藏东西 嘿嘿
-
[self.superview addSubview:msgLabel]; 添加到父控件上
- block式的动画
-
// 2.10设置动画,(block式动画)
// animateWithDuration:动画执行的时间
// animations:执行动画的代码
// completion:动画完成后执行的代码
[UIView animateWithDuration:3 animations:^{
msgLabel.alpha = 0.5;
} completion:^(BOOL finished) {
if (finished) {
// delay:延迟:表示动画动画延迟多长时间以后执行
[UIView animateWithDuration:3 delay:0.5 options:UIViewAnimationOptionCurveLinear animations:^{
msgLabel.alpha = 0.0;
} completion:^(BOOL finished) {
// 让msgLabel这个控件从父类中移除
[msgLabel removeFromSuperview];
}];