iOS小记

1.iOS切换使用http : 

<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
2.图片布局设置

  1. UIImage *pic = [ UIImage imageNamed:@"IMG_0404.PNG"];  
  2. UIImageView *imageView   = [[UIImageView alloc] initWithFrame:CGRectMake(20, 20, 240, 100 )];  
  3. [imageView setImage:pic];  
  4. [imageView setContentScaleFactor:[[UIScreen mainScreen] scale]];  //根据屏幕类别选择图片
  5. imageView.contentMode =  UIViewContentModeScaleAspectFill;  
  6. imageView.autoresizingMask = UIViewAutoresizingFlexibleHeight;  
  7. imageView.clipsToBounds  = YES;
3.svn常用命令

http://www.cnblogs.com/newstar/archive/2011/01/04/svn.html

4,Search Bar 怎样去掉背景的颜色(storyboard里只能设置background颜色,可是发现clear Color无法使用)

其实在代码里还是可以设置的,那就是删除背景view

[[self.searchBar.subviews objectAtIndex:0] removeFromSuperview];

5.iOS8后本地通知设置

http://blog.csdn.net/woaifen3344/article/details/44302635


6.录音设置

```

recordSetting = [[NSMutableDictionary alloc]init];

    //设置录音格式  AVFormatIDKey==kAudioFormatLinearPCM

    [recordSetting setValue:[NSNumber numberWithInt:kAudioFormatMPEG4AAC] forKey:AVFormatIDKey];

    //设置录音采样率(Hz) 如:AVSampleRateKey==8000/44100/96000(影响音频的质量)

    [recordSetting setValue:[NSNumber numberWithFloat:44100] forKey:AVSampleRateKey];

    //录音通道数  1 或 2

    [recordSetting setValue:[NSNumber numberWithInt:1] forKey:AVNumberOfChannelsKey];

    //线性采样位数  8、16、24、32

    [recordSetting setValue:[NSNumber numberWithInt:16] forKey:AVLinearPCMBitDepthKey];

    //录音的质量

    [recordSetting setValue:[NSNumber numberWithInt:AVAudioQualityHigh] forKey:AVEncoderAudioQualityKey];

    

    //    recordSetting = [[NSDictionary alloc] initWithObjectsAndKeys:

    //

    //                     [NSNumber numberWithFloat: 44100.0],AVSampleRateKey, //采样率

    //

    //                     [NSNumber numberWithInt: kAudioFormatLinearPCM],AVFormatIDKey,

    //

    //                     [NSNumber numberWithInt:16],AVLinearPCMBitDepthKey,//采认16

    //

    //                     [NSNumber numberWithInt: 2], AVNumberOfChannelsKey,//通道的数目

    //

    //                     [NSNumber numberWithBool:NO],AVLinearPCMIsBigEndianKey,//大端还是小端是内存的组织方式

    //

    //                     [NSNumber numberWithBool:NO],AVLinearPCMIsFloatKey,nil];

    // NSString *strUrl = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];

    //recordedFile=[NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/lll.aac", strUrl]];

    recordedFile = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent: [NSString stringWithFormat: @"%.0f.%@", [NSDatetimeIntervalSinceReferenceDate] * 1000.0, @"aac"]]];  //文件名的设置

    

    // tmpFile = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingString:@"RecordedFile"]];

    

    [[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryPlayAndRecorderror: nil];

    

    NSError *error = nil;

    recorder = [[AVAudioRecorder alloc] initWithURL:recordedFilesettings:recordSetting error:&error];

    if (recorder!= nil) {

        recorder.delegate = self;

        

        if ([recorder prepareToRecord] == YES&&[recorder record]==YES)

        {

            NSLog(@"录制声音开始!");

            

            

        } else {

            NSLog(@"录制失败!%@",error);

            int errorCode = CFSwapInt32HostToBig ([error code]);

            NSLog(@"Error: %@ [%4.4s])" , [error localizedDescription], (char*)&errorCode);

        }

    } else {

        NSLog(@"auioRecorder实例创建失败!");

    }




```

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值