]init]; //存放每一帧播放的时间 NSMutableArray * timeArray = [[NSMutableArray alloc]init]; //存放每张图片的宽度... (一般在一个gif文件中,所有图片尺寸都会一样) NSMutableArray * widthArray = [[NSMutableArray alloc]init]; //存放每张图片的高度... NSMutableArray * heightArray = [[NSMutableArray alloc]init]; //遍历 for (size_t i=0; inumberWithFloat:width]]; [heightArray addObject:[NSNumber numberWithFloat:height]]; ...; i++) { [times addObject:[NSNumber numberWithFloat:currentTime/totalTime]];
结论: alloc负责分配内存和创建对象对应的isa指针; init只是返回alloc生成的对象。 所以alloc后,多次调用init,返回的对象是同一个!...代码如下: 1 // 2 // main.m 3 // alloc.initTest 4 // 5 // Created by LongMa on 2019/5/30. 6 // Copyright...]; 17 NSLog(@"%p",obj1); 18 19 NSObject *obj2 = [obj1 init]; 20 NSObject...*obj3 = [obj1 init]; 21 NSLog(@"%p",obj2); 22 NSLog(@"%p",obj3); 23 } 24 return...09:35:37.019864+0800 alloc.initTest[65183:12003258] 0x10065d810 2019-05-30 09:35:37.019874+0800 alloc.initTest
animationWithKeyPath:@"opacity"]; opacityAnimation.duration = 0.8; opacityAnimation.fromValue = [NSNumber...numberWithFloat:0.0]; opacityAnimation.toValue = [NSNumber numberWithFloat:0.8];...animationWithKeyPath:@"opacity"]; opacityAnimation.duration = 0.5; opacityAnimation.fromValue = [NSNumber...numberWithFloat:1.0]; opacityAnimation.toValue = [NSNumber numberWithFloat:0.3]; opacityAnimation.removedOnCompletion...到此,讲解完毕,最后丢上效果图和下载地址。 Untitled.gif 下载地址-------戳这里 如对你有帮助,请不要吝惜你的star和喜欢哦!
animationWithKeyPath:@"opacity"]; opacityAnimation.duration = 0.8; opacityAnimation.fromValue = [NSNumber...numberWithFloat:0.0]; opacityAnimation.toValue = [NSNumber numberWithFloat:0.8]; opacityAnimation.timingFunction...animationWithKeyPath:@"opacity"]; opacityAnimation.duration = 0.5; opacityAnimation.fromValue = [NSNumber...numberWithFloat:1.0]; opacityAnimation.toValue = [NSNumber numberWithFloat:0.3]; opacityAnimation.removedOnCompletion...到此,讲解完毕,最后丢上效果图和下载地址。 [strip] 下载地址-------戳这里
折线图.gif 通过自定义UIView使用自定义init方法赋值数据源,后调用 UIView的drawRect方法进行绘制。...numberWithFloat:0.0f]; pathAnimation.toValue = [NSNumber numberWithFloat:1.0f]; [_chartLine addAnimation...如果需要设置字体排版(如居中)** NSMutableParagraphStyle * paragraph = [[NSMutableParagraphStyle alloc]init]; paragraph.alignment...numberWithFloat:0.0f]; pathAnimation.toValue = [NSNumber numberWithFloat:1.0f]; pathAnimation.autoreverses...numberWithFloat:x]; animation.toValue = [NSNumber numberWithFloat:y];; animation.timingFunction
能够检测动画的执行和结束。 path:帧动画中的执行路径 type:过渡动画的动画类型。...numberWithFloat:1.0f]; animation.toValue = [NSNumber numberWithFloat:0.0f]; animation.autoreverses...numberWithFloat:1]; rotationAnimation.fromValue = [NSNumber numberWithFloat:-1]; rotationAnimation.duration...] init]; group.duration = 3.0; group.fillMode = kCAFillModeForwards; group.removedOnCompletion...示例: MyViewController *myVC = [[MyViewController alloc]init]; CATransition *animation = [CATransition
]init]; for (int i =0 ; i<5; i++) { UIView * view = [[UIView alloc]init]; view.backgroundColor...我们的布局没有问题,并且可以动态的改变其中view的个数,使用如下方法添加一个view: UIView * newView = [[UIView alloc]init]; newView.backgroundColor...,下面我们再来仔细介绍一下与其相关的属性和方法的使用,使我们能够更加得心应手。...]init]; for (int i =0 ; i<5; i++) { UIView * view = [[UIView alloc]init]; view.backgroundColor... numberWithFloat:height]); }]; [array addObject:view]; } stackView = [[UIStackView
下边附上代码: //1.渐变的简单实现demo UIView *bgView = [[UIView alloc]initWithFrame:CGRectMake(0, 15, 100, 100...scaleAnimation1 = [CABasicAnimation animationWithKeyPath:@"transform.scale"]; scaleAnimation1.fromValue = [NSNumber...numberWithFloat:1.0]; scaleAnimation1.toValue = [NSNumber numberWithFloat:1.5]; scaleAnimation1...CABasicAnimation animationWithKeyPath:@"transform.rotation.z"]; rotationAnimation2.fromValue = [NSNumber...numberWithFloat:0]; rotationAnimation2.toValue = [NSNumber numberWithFloat:6.0*M_PI]; rotationAnimation2
]init]; NSMutableString * values = [[NSMutableString alloc]init]; for (int i=0; iinit]; NSMutableArray * keysTypeArr = [[NSMutableArray alloc]init]; if (keys==nil||keys.count...=SQLITE_OK) { YHBaseSQLError * error = [[YHBaseSQLError alloc]init]; error.errorInfo ... * value = [NSNumber numberWithFloat:sqlite3_column_double(stmt, i)]; [dic setObject... * value = [NSNumber numberWithFloat:sqlite3_column_double(stmt, i)]; [dic setObject
要先引入AVFoundation的框架 #import self.voiceRecorder = [[AVAudioRecorder alloc...Path:声音文件录制后存储的路径 Setting:一个录制参数的字典,设置一些录制的必要的参数,需要进行调整到合适的值 _recorderSetting = [[NSDictionary alloc...] initWithObjectsAndKeys: [NSNumber numberWithFloat: 8000.0],AVSampleRateKey...[NSNumber numberWithInt:16],AVLinearPCMBitDepthKey,//采样位数 默认 16 [NSNumber...[self.player play]; NSLog(@"开始播放"); }else{ NSLog(@"no voice"); } 声音播放也可以暂停恢复和停止
] init]; [recordSettings setValue :[NSNumber numberWithInt:kAudioFormatLinearPCM] forKey: AVFormatIDKey...]; [recordSettings setValue :[NSNumber numberWithFloat:11025.0] forKey: AVSampleRateKey];//44100.0 [recordSettings...//音频开始播放 - (void)startPlayAudioFile:(NSString *)fileName{ //初始化播放器 player = [[AVAudioPlayer alloc]init...支持本地和网链,更加接近底层,定制也更加灵活。..._ZYQPick) { _ZYQPick = [[UIImagePickerController alloc] init]; //sourcetype有三种分别是camera,photoLibrary
CGFloat margin = (self.frame.size.width - textSize.size.width) / (self.text.length - 1); NSNumber...*number = [NSNumber numberWithFloat:margin]; NSMutableAttributedString *attributeString = [[NSMutableAttributedString...alloc]initWithString:self.text]; [attributeString addAttribute:(id)kCTKernAttributeName value:number
theAnimation.duration=1; theAnimation.repeatCount=2; theAnimation.autoreverses=YES; theAnimation.fromValue=[NSNumber...numberWithFloat:0]; theAnimation.toValue=[NSNumber numberWithFloat:-60]; [view.layer addAnimation:theAnimation...NSFileManager defaultManager] fileExistsAtPath:path]) { // 设置 player player = [[AVAudioPlayer alloc
startViewChangeSmaller { //设置一组动画 //变小 CABasicAnimation *animation1 = [[CABasicAnimation alloc...] init]; animation1.keyPath = @"bounds"; animation1.toValue = [NSValue valueWithCGRect:CGRectMake...0, kStartRadius*2, kStartRadius*2)]; //变圆 CABasicAnimation *animation2 = [[CABasicAnimation alloc...] init]; animation2.keyPath = @"cornerRadius"; animation2.toValue = [NSNumber numberWithFloat...:kStartRadius]; //加入组动画 CAAnimationGroup *group = [[CAAnimationGroup alloc] init]; group.animations
layer上; [view12.layer addAnimation:keyFrameA forKey:nil]; //绕矩形循环跑 CALayer * rectLayer = [[CALayer alloc...] init]; rectLayer.frame = CGRectMake(15, 200, 30, 30); rectLayer.cornerRadius = 15; rectLayer.backgroundColor...numberWithFloat:0.0], [NSNumber numberWithFloat:0.6], [NSNumber numberWithFloat...:0.7], [NSNumber numberWithFloat:0.8], [NSNumber numberWithFloat:1]];...numberWithFloat:1.0]; // 开始时的倍率 animation.toValue = [NSNumber numberWithFloat:2.0]; // 结束时的倍率 // 添加动画
numberWithFloat:1.5]]; [animation setToValue:[NSNumber numberWithFloat:1]]; [animation...}]; } - (UILabel *)duplicateLabel:(UILabel *)labelToCopy { UILabel *duplicateLabel = [[UILabel alloc...// Create a new badge because not existing self.badge = [[UILabel alloc...*number = [NSNumber numberWithDouble:badgePadding]; objc_setAssociatedObject(self, &badgePaddingKey...*number = [NSNumber numberWithDouble:badgeMinSize]; objc_setAssociatedObject(self, &badgeMinSizeKey
if (nil == _AnimationTool) { QCTJoinCartAnimationTool *tmpView = [[JoinCartAnimationTool alloc...{ self = [super init]; if (self) { self.animationDuration = 0.5f; } return...self; } #pragma mark - ******** joinCartAnimationWithRect /** 以inView为参考,计算开始位置和结束位置的rect @param...transform.scale"]; alphaAnimation.duration = self.animationDuration; alphaAnimation.fromValue = [NSNumber...numberWithFloat:1.0]; alphaAnimation.toValue = [NSNumber numberWithFloat:0.1]; alphaAnimation.timingFunction
ludashi~走起~(虽然是12年的东西,这不刚学蛮~在OC中用感觉挺新鲜的,简化后对字典的初始化感觉和PHP有点相似~感觉见到亲人啦~) 问题是数组引起的那么就从数组开始吧 1.一般数组的初始化和访问数组元素是这样的... 在之前的博客中我是这样初始化NSArray的: 1 //NSArray的便利初始化 2 NSArray *array1 = [[NSArray alloc] initWithObjects:@...= [array1 objectAtIndex:0]; NSLog(@"array1_count = %d, array[0] = %@", count, element); 简化后的数组初始化和访问的做法如下...value; +(id) numberWithInt : (int) value; +(id) numberWithFloat...是存的是ASCII码的形式,c输出为97 //NSNumber的简化 NSNumber *a = @123; NSNumber *b = @11.2;
前言 这个动画效果很早就出来了,也是一个比较经典的关键帧动画和组合动画的运用,通过剖析源码,可以发现实际上这个酷炫的动画实现起来很简单。 ?...金币.gif 实现过程 在当前页面加载一个福袋的图片和再来一次的按钮。 在for 循环中使用延迟调用函数。每个函数的调用时间越来越靠后,达到依次出现的效果。...在每个延迟调用函数中创建一个金币的图片,并记录它的tag和最终的位置。 为这个金币图片随机生成开始位置,并根据开始位置和结束位置计算出控制点,利用这三点绘制二次贝塞尔曲线。...UIImageView *coin = [[UIImageView alloc] initWithImage:[UIImage imageNamed:[NSString stringWithFormat...numberWithFloat:- 0.2]; shake.toValue = [NSNumber numberWithFloat:+ 0.2]; shake.duration =